Getting Started with Amazon EC2
Note: This is an update of an article originally posted on 2011-03-15.
At The Day Job, we’ve started moving some of our server infrastructure to Amazon EC2. Occasionally, we need to radically increase the processing power available for continuous integration, unit testing, and user acceptance testing, but don’t want to incur the cost of all that horsepower when we don’t need it. Cloud-based solutions like EC2 1 are a good fit for this kind of on-demand usage.
There are a few things you’ll need to do once before we can get our hands dirty.
Install the AWS command line tools
Amazon provides a nice GUI interface to their web services, but I’m intending to automate the process of starting and stopping servers eventually, so learning to use the command line tools seems the smart thing to do.
Rather than go into the steps to install and set up the command line tools, I’m going to refer you to Amazon’s own documentation at http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-set-up.html .
Create a security group
I could (and probably should) write a whole article about security practices when using AWS. For now, we’re going to initialize a security group to use in further examples without going into too much detail.
First, create the security group.
You can name it something other than
demo-sg if you desire, but make sure to use the new name from here on out.
We’ll want to use SSH to log in to the instances we boot, so we need to enable traffic through the default SSH port.
For added security, we could restrict logins to only those from a single IP address or a range of IP addresses. Here, we’re allowing logins from any IP address, which should be fine for our purposes.
Create an SSH key pair
Instead of having to remember passwords for each EC2 instance, which should be both complex and unique, we’ll set up an SSH key pair, half of which will remain private and local to your local computer.
As with the security group, you can name it otherwise, but be sure to change the following examples as appropriate.
The following posts in this series will assume that these steps have already been taken.