When Amazon first launched their Elastic Compute Cloud (EC2) in 2006, many people were a bit surprised. Those of us who’d always just thought of Amazon as a retailer were skeptical that they’d have much to offer. In the 5 years since then, Amazon has proven that they’re serious about this business and in making EC2 a world-class cloud computing platform. While there have been hiccups, Amazon Web Services in general are typically regarded as among the best in the business. In this guide, we’re going to cover the basics of cloud computing in general and Amazon EC2 in particular.
A Bit About “The Cloud”
As with many tech buzzwords, you might get a different definition of this term from each person you ask. Some might describe it as a way of scaling your computing resources to fit your needs.
Let’s say ABC Books, a local book store wants to run a site where their customers can buy books online. The “traditional” approach would be for someone to dust off a server, install an OS, run a webserver application and load their site on it.
When virtualization was becoming popular, people started using another method called the Virtual Private Server or VPS. With this method, you can have multiple operating systems running on the same machine, each with their own setup and applications.
This allows each user to have full control over their system, but without the expense of dedicated hardware. ABC Books, our example complany, would likely save money by switching to VPS, as they don’t need the server’s full power and can share the cost with other users. The “cloud” method takes virtualization even further. Since you’re already virtualizing the software, what happens if you virtualize the hardware too? The essence of cloud computing is taking a huge collection of computing resources and intelligently assigning them as needed. Take this diagram for example.
You can see that most of the portions are different sizes. ABC Books might only need a portion of one server, but Bob’s House of Free iPads might generate more traffic and need multiple servers. One of the greatest benefits of cloud computing is that you can scale your resources up and down as needed.
Let’s say a huge celebrity talks about their love of ABC Books, and suddenly the site is getting hundreds of times the amount of traffic it normally would. Their dedicated server is probably not equipped to handle that. Likewise, a VPS (though more flexible) will still need a hardware transfer or upgrade to keep up. A cloud based server, however, could just be “turned up” to handle the excess traffic. When the buzz has died down, you just reduce your resources back to normal.
Signing up for EC2
Note: The free account is indeed free, but during the signup, you will be asked for credit card information. See Amazon’s terms for details.
Log in or create your Amazon EC2 account. Unfortunately, new user registrations can sometimes remain pending for several hours.
Once your Amazon Web Services account is set up, you can access your management console by clicking the Sign In to AWS Management Console link in the top-right corner of aws.amazon.com or clicking here.
Creating an Instance
Once your account is activated and you’re able to access the AWS Console, you’ll probably want to start by creating server instance to run some software.
The first thing you’ll be asked to do is decide on a base platform. The Amazon Linux is a good bet if you’re looking to demo the service.
The next page lets you set some details regarding your instance. You’ll probably want to leave these settings as they are, seeing as how the free tier only supports the Micro instance type, and Availability Zone should make no difference at this stage.
The next page, Advanced Instance Options, should be left at defaults unless you have a specific reason to do otherwise.
The last step of your Instance Options is the one where you choose tags. This step is optional, and nothing will be broken if you specify no tags, but it’s recommended to at least apply a value to the Name key to make this instance easy to identify.
The next step is to create a key pair. Instead of passwords, EC2 uses cryptographic keys to identify users. If that sounds confusing don’t worry, it’s really not that complicated. The first step is to name and generate a key pair, then download that to your computer. I’d recommend saving it to ~/.ssh/.
Once you’ve got the keys saved, you’ll need to make sure it’s private. You cannot skip this step, as SSH will refuse to use a publicly viewable key. It’s quick and easy to set this, just open your Linux or OSX terminal and type:
chmod 600 ~/.ssh/MyEC2Key.pem
and to actually use it to connect, go with
#You will of course have to wait until your instance is actually running ssh -i ~/.ssh/MyEC2Key.pem firstname.lastname@example.org
Finally, you’ve just got to open a hole in the firewall for your app. The dropdown list contains several common network options such as SSH, DNS, and of course HTTP. If you want to enter a custom port, here’s your chance.
Once you review and launch your instance, you’re set! You can now use SSH as indicated above to connect to your public DNS (highlighted in the screenshot below).
From here on out, it’s your “server” to deal with as you wish. Applications can be installed and removed however you see fit. The service is can be tailored to exactly the application you have in mind – anything from a web server to VPN gateway to a place to host your files. Good luck and have fun on the cloud!