Quickstart Guide: Stand up your cloud-based servers with Amazon Web Services EC2

January 7, 2012 Off By David
Grazed from CTOVision.com.  Author: Bob Gourley.

Amazon didn’t invent cloud computing, but they deserve lots of credit for transforming the business model for providing cloud services through elastic computing (for some history see Jeff Bezos’ Risky Bet from Businessweek Nov 2006). They have pushed the economics of cloud computing to be so efficient they are able to offer a 12 months worth of initial compute for free. This is a great opportunity to learn their interface and to test how their computing capabilities might serve your needs.

We have been using Amazon servers for a variety of purposes over the years and have just finished fielding a CDH3 cluster standup there and thought it would be a good time to capture some quickstart lessons to help you get started with your own systems (we have a similar post for Rackspace cloud servers here)…

So, fire up your web browser and follow along and we will have you online with your own cloud-based, scalable, elastic, free system, in minutes:

Step one: Create your login:

  • Start at the URL http://aws.amazon.com  (AWS stands for Amazon Web Services).
  • Click the big yellow button that reads “Get Started with a Free AWS Account”
  • You may sign in with an existing Amazon.com account or sign in as a new user.
  • You will need to enter your billing address and credit card information (Amazon promises not to charge you unless your usage exceeds the free usage tiers). They also need a phone number. Then hit “create account” Amazon will call your phone with a pin that you will need to complete your registration. Now you can use that pin to finalize verification of your account.

You can now sign into AWS anytime from any browser.  Now sign in and create your first virtual server.

Step Two: Stand up your server:

  • If you are not already at the AWS Management Console navigate there by selecting it from the link at the top right of the page or click here: http://aws.amazon.com/console
  • You are now looking at a page with a menu bar like the one below:

 

 

  • Select the tab for EC2. Take a moment to orient yourself to the EC2 dashboard.
  • To launch your virtual server, which Amazon calls an “instance”, click the “launch Instance” button.
  • You now need to pick the operating system and configuration you want. You do this by selecting an AMI (Amazon Machine Instance), which is a pre-set package based around the OS you want. You will want to pick one that is part of the free package, but scroll through the options so you see what is available for future use. I recommend starting with the one that should be on the top, the Basic 32-bit Amazon Linux AMI. Hit the select button.
  • You will now be presented with other configuration options. Instance Type is important. To take advantage of the free offer from Amazon this will need to be “Micro (t1.micro, 613 MB)” so select that one to begin with.  But note that you also have other high end choices.
  • A this stage leave “availability zone” as no preference. When you are building production systems this will be important to you, but not now.
  • Select “continue” for the next page of the instance wizard. You may use defaults for “Advanced Instance Options” and on the next page after you hit “Continue” you can use defaults for key and value tags. Hit “continue” again and you should be at the “Create Key Pair” wizard page.
  • Your key pair will be used to allow you to remotely log into your server. Select “create a new pair”
  • Enter a key name, something simple like “myfirstkey”. Then click the button that says “create and download your key pair”
  • Save the file in a place you will remember. You will need it!
  • After you hit continue you will be presented with options to configure your firewall. If you move to fast on this screen you can block yourself out of your instance, so configure this correctly.
Configuring The Security Group:
  • Add a group name and description, something that will be easy to remember and understand
  • If you are going to SSH into your server (which you will almost certainly want to do to further configure and manage your new server), create a custom TCP rule that has “22″ as the port range.
  • Leave the source IP with the default entry.
  • Hit the “add rule” button. You can change this later as required.

When you have gone through all the above, click “Continue.”  Then review all your settings and click “Launch”.

Your server is now being built. It will be up in a minute and you will see its status reflected in your dashboard.

Now, how do you connect to this new server?

How you connect is a matter of personal choice. I use the old fashioned terminal window and SSH. You can bring one up on most any modern computer. You will need a little info before connecting. You will need to remember where you put the key you downloaded. You will also need to know the Public DNS pointer that Amazon created. You can find that in the “instances” window of EC2. It will look something like “ec2-50-16-52-139.compute-1.amazonaws.com”

From the terminal window:

  • Navigate to the location where you stored your keypair. You need to make sure it has the right permissions so that you can use it, Amazon can accept it, and others will have a harder time seeing it.  Enter this in your terminal window:

sudo chmod 400 myfirstkey.pem

  • Now you can log into your server using SSH and your keypair. You will log in as ec2-user with the public DNS name amazon gave you. your command will look something like:

sudo ssh -i myfirstkey.pem -l ec2-user ec2-50-16-52-139.compute-1.amazonaws.com

You should get feedback from that command that says something like:

The authenticity of host ‘ec2-50-17-121-192.compute-1.amazonaws.com (50.17.121.192)’ can’t be established.
RSA key fingerprint is 69:eb:66:d9:34:18:1a:8a:03:1b:68:f8:7c:12:e6:c8.
Are you sure you want to continue connecting (yes/no)?

Type “yes” and you are in business. You are now logged into the server and can execute any commands you could on any other server you own.

 

More about AWS Free Usage (from the AWS site):

To help new AWS customers get started in the cloud, AWS is introducing a free usage tier. New AWS customers will be able to run a free Amazon EC2 Micro Instance for a year, while also leveraging a free usage tier for Amazon S3, Amazon Elastic Block Store, Amazon Elastic Load Balancing, and AWS data transfer. AWS’s free usage tier can be used for anything you want to run in the cloud: launch new applications, test existing applications in the cloud, or simply gain hands-on experience with AWS.

AWS Free Usage Tier (Per Month):

We hope the above is enough to get you started.  We have a post coming soon on how to do the same thing with Rackspace. We are also preparing one on how to launch a Cloudera CDH3 Hadoop Cluster using cloud capabilities. More on all that soon!