If you’re anything like me, you probably log in and out of a half dozen remote servers on a daily basis. And if you’re even more like me, you have trouble remembering all of the various usernames, remote addresses and command line options for things like specifying a non-standard connection port or forwarding local ports to the remote machine. And sometimes you have to do the same thing in a lot of servers, this post is for you.
In case you lose your Amazon EC2 SSH Key, and can’t login in your instance. This isn’t a big problem if your instance is EBS based and you use an Elastic IP.
1. Upload your new SSH Key, or use one made by AWS
2. Make an AMI of your instance
3. Launch a new machine from your AMI, select the new SSH Key
4. Log in your machine with default user (ubuntu, ec2-user, depends on your original AMI image)
5. Change the Elastic IP to the new machine
6. Turn of the old machine and terminate it.