Adding an SSH Key to Amazon EC2

Using git to deploy code across multiple servers is a handy technique that works in pretty much any situation. That is, until you’re trying to deploy to an environment such as Amazon’s EC2 servers, which uses .pem files to login. In these situations, the simplest solution I’ve found is a rather ancient technique: SSH keys.




Step 1: Generate an SSH Key

Note: If you already have an ssh key then you can skip this step

After you hit enter, you’ll get some messages similar to these:

Step 2: Add Your Key to Your Amazon EC2 Instance

Use the following command to copy your key to your Amazon EC2 instance. /you/.ssh/id_rsa.pub is the location to your ssh key, pem_file.pem is the .pem file you normally use to login, and user@ec2-instance.com is the user and hostname to your EC2 instance:

One response to “Adding an SSH Key to Amazon EC2

Leave a Reply

Your email address will not be published. Required fields are marked *

×Mike Everhart

Need Some More Help? Let's Talk!

I'd love to work with you! Fill out the form below to schedule a free consultation to discuss your needs and how I can help.

Need More Help?