Note: This is mainly useful for instances you are essentially locked out of in the case where you don't want to create a new instance.
- Launch a micro instance with your new key (we'll call this the "key transitioning instance"). This instance will need to be in the same availability zone ("us-east-1b", for example) as the instances you are locked out of.
- Make sure you can ssh in
- Select the instance you are locked out of and make note of the attached EBS volume ID which will look something like
vol-6a844e25and the Root Device which will look something like
- Stop the EC2 instance you are locked out of
- Go to that instance's Root Device EBS volume and detach it
- Re-attach the EBS volume to the key transitioning instance
- On the key transitioning instance, run
sudo fdisk -l
- Note the "Device" column output from this command that is similar to the "Attachment information" which is displayed when you select the EBS volume (we'll use
/dev/xvdf1as an example). That will be yo