Attach an existing EBS as the root device in the instance instance request

Is it possible to include an existing, unattached accessible EBS volume as the root device in a location instance request? I would like to create an installation in which the system works and works when the spot price is reached, and after the termination the spot price returns to the range. I can re-query and start the instance where I left off.

thanks!

+7
source share
2 answers

Although overriding the mapping of AMI block devices as such, perhaps the root device is an exception, unfortunately:

Any instance you launch automatically includes any storage devices in the display of the device of the AMI block. You can override this mapping to indicate the display of the block device with the changes you want to change the startup time. In your overrides, you can change the display for any of the storage devices, with the exception of the volume of the root device . [emphasis mine]

This is also reflected in the corresponding wizards in the AWS Management Console , which allow you to adjust the size of the root volume, but it is not based on a snapshot, see the image inside Changing the volume of the root device to save .

+3
source

You can load the pivot_root default volume and then pivot_root init onto a separate EBS volume.

The EC2 Spotter tool will help you with this. Excerpt from the EC2 Spotter documentation:

The startup script uses user data to create a boot script that attaches the specified EBS volume to / dev / xvdf and then runs pivot_root and chroot to use it as the main system drive instead of / dev / xvda. When an instance is first created or restarted after interruption, / sbin / init on the AMI-based EBS volume (/ dev / xvda1) is replaced by a small shell script that performs the magic actions of pivot_root and chroot, and then loads the / sbin / init chain from the specified constant EBS volumes (/ dev / xvdf1). Additional reboots are performed the first time the instance is started to ensure cleanliness. The end result is a complete Linux system running on a constant dev / xvdf volume mounted as /. The ephemeral disk remains mounted in / old-root and can be unmounted if necessary.

Also see StackOverflow's answer: AWS EC2: How to remount a previous EBS volume using pivot_root?

0
source

All Articles