Can I change the root EBS device of my amazon EC2 instance?
I have an EBS backed Amazon EC2 instance. I would like to change the root device on this instance. Can you please advise the best way to go about this?
I only find documentation on changing several attributes of block devices, but they don't seem to include setting it as the root device.
Yep, it's dead easy:
- Stop the instance.
- Detach the root EBS volume.
- Attach the alternate EBS volume as the root:
/dev/sda1
- Start the instance.
This presupposes that your alternate EBS volume is bootable, of course - it has to contain the bootable OS image.
I don't have enough rep to add a comment to the selected answer, but I do want to point out that for me, /dev/sda1
did not work (did not attach as root), but using /dev/xvda
worked (attached as root). The instance is one of the newer t2.micro ones using HVM.