Amazon Elastic Compute Cloud (EC2) delivers scalable, pay-as-you-go compute capacity in the cloud. It is a part of a collection of remote computing services (also called web services) from Amazon that together make up a cloud computing platform. The most central and well-known of these services are Amazon EC2 and Amazon S3. The goal in this post is to get you up and running on an EC2 instance super fast.
I’m going to assume you have an account with AWS and are familiar with:
- AWS Management Console: http://aws.amazon.com/
- Understand the Instance concept when referring to EC2.
- Familiar with Ubuntu Server.
If you do not know those 3, please spend some time learning about them by following the links in the bullet points above. Else, let’s get rollin.
Step by step guide
1. Setting up security
Before we launch an Instance you need to do some Pre-work since both “Security Group” and “Key Pair Name” cannot be changed once an Instance is mapped to one and started.
- Setup a “Security Group” for your new Linux Instance.
- From Navigation menu select “Security Groups”.
- Click on “Create Security Group” button and fill out the form giving your security group a very descriptive name.
- Click “Yes, Create” button, select the new group and in the lower half window/frame press the “Inbound” tab.
- Inbound allows you to open ports on this Instance. You can add or remove these after the Instance is created. By default allow these: SSH (22), HTTP (80) and MySQL (3306). For extra security limit (source) SSH & MySQL to only your IP address. If you plan to install Webmin add port 10000 here too.
- When done, click on “Apply Rule Changes”.
- Create a “Key Pair Name”.
- This is super important and will be used for accessing your Instance both via SSH & sFTP.
- From Navigation menu select “Key Pairs”.
- Click on “Create Key Pair” button.
- Give it a descriptive Key Pair Name and click on “Create” button. A private key with extension .pem will download. Save this in a secure location since this is your key to access your Instance.
- On your local machine (Linux X or Mac OS X), give this file more secure permissions like this:
chmod 0700 ./keys/mykey.pem
2. Launching an Instance
- From Navigation menu select “Instances”.
- Click on “Launch Instance” button.
- This launches the Request Instance Wizard where you can select an Amazon Machine Image (AMI). Note that Ubuntu is only available from “Community AMIs”. Click the Community AMIs tab.
- Here is a list of available Ubuntu images:
- Make sure you use an EBS root store – it’s better. For benefits see here:
- Here is a list of available Ubuntu images:
- Step through the 5 stages of the Wizard and click on “Launch” button. This will launch your new Instance. The Wizard is straight forward and you will most likely go with all the defaults.
- Your Linux Instance will launch pretty fast. You should now see your Instance listed under “My Instances”.
- Click on your Instance. Instance properties window/frame shows up in the bottom half of the console. Note down “Public DNS” and “Private DNS/IP Address”. You will need those to access the box – especially the Public DNS.
3. Building a Ubuntu LAMP Web Server on your new Instance
This step is optional.
But should you want to setup LAMP on this new Instance follow the steps outlined in my previous post here: http://www.theroadtosiliconvalley.com/technology/building-ubuntu-lamp-web-server-vm/
The only additions in light of Amazon EC2 host are:
- When using SSH/sFTP use the private key with extension .pem you downloaded above.
- Note that root user in EC2 is “ubuntu” not “root” like in a VM Ubuntu setup.
- To SSH into your new EC2 Instance do this in terminal where the URL after @ is your Public DNS:
ssh -i ./keys/mykey.pem firstname.lastname@example.org
- Use the Public DNS or setup a static IP address to point to your Instance(s). Amazon calls this Elastic IP Address and this allows you to have multiple Instances all pointing to the 1 IP address for dynamic cloud computing.
Now go and build kick ass products!
There you have it folks. How simple is that. Amazon makes cloud computing look simple and launching new servers (Instances) is a breeze.. in a matter of minutes.
If you found this post useful let me know in comments section below. Super!!
Latest posts by Ernest W. Semerda (see all)
- CodePath Bootcamp: learn Android & iOS the Better way - January 3, 2017
- Y Combinator’s Startup School 2016 — the recap, highlights & lessons - September 23, 2016
- Altered States: The Art of Floatation as a Company Benefit - September 11, 2016