

Give your new key pair a name, save the.Under NETWORK & SECURITY, click on Key Pair Click on Create Key Pair.This would only apply to new instances you run. Uploading Personal ssh Keys to Amazon EC2 While you're thinking about ssh keypairs on EC2, I recommend uploading your own personal ssh public key to EC2 instead of having Amazon generate the keypair for you. You don't want to make a mistake and lock yourself out of the instance entirely. Depending on the AMI you are running, it might be in one of: /home/ec2-user/.ssh/authorized_keysĪfter editing an authorized_keys file, always use a different terminal to confirm that you are able to ssh in to the instance before you disconnect from the session you are using to edit the file. ssh subdirectory under the home directory of the user you are logging in as. If you want to change what ssh key you use to access an instance, you will want to edit the authorized_keys file on the instance itself and convert to your new ssh public key. ssh/authorized_keys file so that you can ssh in as that user using the corresponding private ssh key. There is a startup process on most AMIs that downloads the public ssh key and installs it in a. Once an instance has been started, there is no way to change the keypair associated with the instance at a meta data level, but you can change what ssh key you use to connect to the instance. Attach volume A back to the main instance as /dev/xvda.Copy ~/.ssh/authorized_keys to /mnt/tmp/home/ubuntu/.ssh/authorized_keys.$ sudo mkdir /mnt/tmp sudo mount /dev/xvdf1 /mnt/tmp SSH to the new micro instance and mount volume A to /mnt/tmp.Attach volume A to the new micro instance, as /dev/xvdf (or /dev/sdf).Make sure you create it in the same subnet, otherwise you will have to terminate the instance and create it again. Start new t1.micro EC2 instance, using my new key pair.Detach its /dev/xvda1 volume (let's call it volume A) - see here.Here is what I did, thanks to Eric Hammond's blog post: If you still have SSH access, please use one of the answers below. This answer is useful in the case you no longer have SSH access to the existing server (i.e.
