Joel Kleier's Electric Froth

up

A couple AWS Tips {{title}} Tricks

by Joel Kleier on 2014-10-23


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.

  1. Make sure the instance you want to get back into is shutdown (we'll call this 'old instance')
  2. Either create a new instance or use an existing instance (we'll call this 'new instance')
  3. Detach the root volume from the old instance, and attach it to the new instance
  4. Boot up new instance, and mount it temporarily with a command something like mkdir -p /media/tmpmnt/ && mount /dev/xdvf /media/tmpmnt/
  5. Modify the old instance fstab (sudo vim /media/tmpmount/etc/fstab) by commenting out, deleting, or modifying the offending line
  6. Unmount old instance root volume from new instance (umount /media/tmpmnt/)
  7. 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 /dev/sda1
  8. 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.