- The machine must be EBS based.
- Create a new t1.micro instance in the same availability zone as the affected machine with a new Tag name but pointing to same key pair as the affected machine is pointed to.
- Stop the affected machine (do not terminate) – this is only possible with EBS machines)
- Detach the EBS volume from the affected machine (by default attached as /dev/sda1)
- Attach the detached EBS device to the new machine at location (e.g. /dev/sda2)
- SSH into the new machine using putty and mount the affected machine’s root filesystem (/dev/sda2) to somewhere (e.g. in /mnt/fs) and edit the authorized_keys file at location /mnt/fs/sda2/root/.ssh/authorized_keys for root or /home/user/.ssh/authorized_keys for user and add your existing key-pair public key to it.
Command to mount affected machine’s root file system to new machine’s /mnt directory:
mount /dev/sda2 /mnt/fs
- Once changes are done, unmount the affected volume. Stop the new machine, detach the volume from it and terminate the new machine.
Command to unmount:
- Re-attach the affected device to the affected machine (which is already stopped) – ensure to attach it as the same device it was before (e.g. /dev/sda1)
- Re-start your old machine. ssh to the machine and you should be able to use your old machine.
You can also view other big data tutorials here.