Recently, I’ve been playing around with AWS – here are a couple of tips/tricks I found when I had to fix some problems. Hopefully they can help, but: your mileage may vary!
Attaching and Detaching a root volume
Problem: you didn’t specify
nobootwait as an option in fstab, and you detached the volume from an instance, BUT you still want to get back into that instance.
- Make sure the instance you want to get back into is shutdown (we’ll call this ‘old instance’)
- Either create a new instance or use an existing instance (we’ll call this ‘new instance’)
- Detach the root volume from the old instance, and attach it to the new instance
- Boot up new instance, and mount it temporarily with a command something like
mkdir -p /media/tmpmnt/ && mount /dev/xdvf /media/tmpmnt/
- Modify the old instance fstab (
sudo vim /media/tmpmount/etc/fstab) by commenting out, deleting, or modifying the offending line
- Unmount old instance root volume from new instance (
- Attach to old instance root volume back to old instance – NOTE: you will need to explicitly use the partiion number on the device to mount it is root, IE
- Boot up old instance, and it works!
Enabling or Disabling Public IP on an already created instance
Problem: you want to switch the ‘Automatically assign Public IP’ option for an instance… but you can’t do this because it’s already created.
Basically, you need to detach the root volume on the old instance, create a new instance, detach the root volume on the new instance, attach the old root instance to the new instance as the root volume, then delete the new instances detached root volume.
After you do that, you boot up the new instance and test it out, then delete the old instance as well.