I’m setting up some free Amazon EC2 instances so I can run my Twitter data collectors without violating the terms of my Dreamhost hosting agreement or worrying about losing power on my office machine (happened just last week). Despite the many Google results for “getting started with ec2 on a mac”, the process is not that complicated.
First, you need to generate an SSH key pair. The AWS Management Console makes this easy: Choose “Key Pairs” from the left menu bar under EC2. Follow the instructions, and download your *.pem somewhere you’ll remember.
Then, start your EC2 instance with that key pair and associate your elastic IP with that instance.
Once you have an EC2 instance up and running with your designated key pair, you should be able to SSH in just like you do to other servers:
ssh -i ec2-keypair ec2-user@ec2-elastic-ip
ssh-add ec2-keypair.pem before
ssh so you can drop the
Problem: I get
Permission denied (publickey).
- Make sure you’re using the right public key (check your EC2 Management Console. The Key Pair Name should match the *.pem you’re using.
- Use the full path to the *.pem file for
- Make sure you’re using the right username, should be
Many forums recommend Elasticfox Firefox extension for managing your AWS instances. That’s overkill if you just want to SSH in and get something started. Clicking the “Connect to Instance” button in Elasticfox just opens terminal with the SSH command above anyway. So, if you’re a happy Chrome user like I am, you can continue to avoid Firefox and connect happily on your own via the command line.