Today we will cover how to set up an Ubuntu server on Amazon Web Services (AWS) EC2 (Elastic Compute Cloud) instance.
First, we need to sign up for an AWS account. Go to the AWS site and in the top utility bar click “Sign Up”. Note that you will have to enter a credit card number, but thanks to Amazon Free Tier they will not charge it. You can use the free tier for a year. This allows you to set up a “Micro Instance” for free. Micro instances are not that powerful, but our main goal is to set up a small web server (or play with Linux) and this will definitely be good enough for that.
Once you have signed up, you can go to the “Management Console“. You can get to this by clicking “My Account / Console” in the top navigation, then clicking on “AWS Management Console” in the dropdown that appears. Once you are at your Management Console, click on EC2. Now you should be at a screen that looks something like this –
Now in the left sidebar click on “Instance”. It’s time to get an instance up and running! Click “Launch Instance”. A menu with 3 different choice should pop up like this – Select “Classic Wizard” and press “Continue”. Now you have a choice of different Linux distros and Windows Servers. Choose the 64 bit Ubuntu 12.04 and press “Select”. We are going with a barebones Ubuntu install because we want to install most the other software ourselves. Plus Ubuntu is fairly popular and there are a lot of tutorials written for it when we get stuck. Keep clicking “Continue” until you get to a screen like this –
This will prompt you to create and download your “Key Pair”. This is basically the key to get into your server. Initially you don’t have a password set up for your server so you can only use this file to access your server. Sounds fairly secure right? Be sure to generate this and store it in a safe place. You will need it soon. Keep clicking
“Continue” and eventually you will get to a screen that will allow you to “Launch” your server.
Once your instance has launched (it may take a couple minutes for it to get ready for you), get ready to associate an IP address with it. Initially the AWS instances come with long names (mine is ec2-23-22-27-184.compute-1.amazonaws.com). To associate an IP, click on “Elastic IP” in the left sidebar, then click “Allocate New Address”, then click “Yes, Allocate” (seems pretty simple). Once you IP has been allocated, right click on that IP and click “Associate” and attach it to the instance you just created.
From this point on, I will assume you are some what familiar with using the command line (Mac or Linux). If you are using Linux, you are definitely comfortable with using the command line. If you are using Windows, please go to and install Cygwin. This is a fairly light tutorial for using the command line (http://www.linfo.org/command_line_lesson_1.html). All you really know is how to navigate between directories really.
Once you have opened up a command line window (Terminal for Mac/Linux users) and have reached the directory where you put your key file, type in the following command.
chmod 400 keyfilename.pem
Replace “keyfilename.pem” with the actual file name of your keyfile. This command basically closes up the user permissions on this file so only the current user (you) can access it. This is necessary also or else you will get an error when you execute the next command. Once you are ready, it’s time to access your server. Type in the following command
ssh -i keyfilename.pem ubuntu@your-ip-address
Replace “keyfilename.pem” with the actual file name of your key file and replace “your-ip-address” with the IP address you had allocated to the server.
Now you are logged into Ubuntu on AWS. Next time we will walkthrough installing a web server on Ubuntu.