Skip to content

Instantly share code, notes, and snippets.

@steelThread
Created July 16, 2011 12:59
Show Gist options
  • Save steelThread/1086341 to your computer and use it in GitHub Desktop.
Save steelThread/1086341 to your computer and use it in GitHub Desktop.
Setup an ubuntu instance on ec2

References

ec2 starters guide

Security Groups

Before we startup an AMI we need to setup the security group that we will apply to the instance. Essentially we want to allow inbound traffic on 22 (ssh) and the http ports (80, 443). I like to do this on the default security group. Here's an image of the inbound tab for my default security group:

Starting an Amazon Machine Image (AMI)

Step 1 :Select an AMI

When you start our instance you will first need to select an AMI to fire up. I like ubuntu linux distributions because their package repos are pretty comprehensive.

The first step in starting an instance is to select an AMI to start switch over to the community tab and search for ami-ccf405a5 and select it. This is the 10.10 Maverick Meerkat dist and will be just fine for now. We may want to use 11.04 Natty Narwhal, but for now this ami will work just fine.

Step 2: Instance Details

This is the step where you select the instance type, which for us will be small. We are going to be in the east region so any Availability Zone will be fine.

There are a couple more screens related to you the instance. The only thing I would do is add a tag for the instance, tag it as Redis.

Step 3: Create key pair

Select your default key pair. I called mine ec2-keypair. This is the keypair that you created with your account and will be just fine.

Step 4: Configure the firewall

Select the default security group that you setup above.

Step 5: Fire it up

Start the instance.

Getting the AMI up to date.

SSH onto the new host

ssh -i ubuntu@

Update the installed packages.

$ sudo apt-get update  
$ sudo apt-get -y upgrade

Install build tools, git and nginx

$ sudo apt-get install build-essential
$ sudo apt-get install libssl-dev
$ sudo apt-get install git-core
$ sudo apt-get install nginx

Take a snapshot at this point.

Go to back to the AWS management console can create a snapshot of this fresh image.

Install Redis

I prefer to use chef for this step. The redis recipe implements some unix sys admin best practices. Once you are at this point let's touch base. I want to use chef to configure our servers so we can setup an account with ops code. I'll walk you through this. We will also need to setup ngnix as a reverse proxy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment