I've been calling this doc, while I was writing it, "EC2 for Poets."
The goal is to make cloud computing less mysterious by helping people through the process of setting up a server on Amazon EC2. The title derives from a class that was offered at the University of Wisconsin, when I was a grad student there, called Computer Science for Poets.
I loved the idea then, and still do. Engineers sometimes mystify what they do, as a form of job security. I prefer to make light of it, so more people will be tempted to give it a try. It was easy for me, why shouldn't it be easy for everyone? :-)
Dave Winer March 2009, Berkeley CA
Podcast roadmap
This howto was officially announced on March 21, 2009.
To commemorate the occasion with appropriate fanfare, I recorded a 22-minute podcast roadmap for this work.
Even if you don't install the server, it might be useful to listen to the podcast to get an idea of why this may turn out to be important.
Creating a server on Amazon EC2
There's this great service called EC2 run by Amazon, the same Amazon you can buy books and refrigerators from.
EC2 allows you to create your own server in Amazon's server farm located somewhere "up there" in the clouds. It could be in Montana or New Jersey, or Bumfrak, Egypt. You don't have to know or care where the server is.
You also don't have to talk to anyone to create a server, and when you're done with it, just shut it off. You only pay for what you use, and it doesn't cost very much. If you run a server for 8 hours it costs about $1.
If you've ever purchased anything at Amazon, you're all set. And if you haven't, all you need is a credit card.
I think any reasonably knowledgable user could get a server set up this way. You might have to scratch your head, or read the instructions two or three times to get past the hardest parts. I'm thinking of Scoble or NakedJen as I write these instructions. I think either of them could do it, if they really wanted to.
BTW, I don't own any Amazon stock, and I don't make any money when you set up a server. I just feel this is a basic skill any technical user should have. I think it'll change the way you think about computing. I'm sure of it. Also by getting an idea of who can set up a server this way, I'll have a better idea of what kinds of software I should be thinking for this platform.
One more thing -- Ken Sedgwick blazed this trail. He wrote an initial howto which I expanded on in this piece. Thanks Ken!
Requirements
1. An account at Amazon.
2. A Windows machine or a Macintosh.
3. Anywhere from 10 minutes to an hour.
A Hello World server
In this experiment we'll start up a server that you can access over the Internet that will display Hello World and the current time on the server. You can refresh the page as many times as you like. The time will change, but that's all it does. From there, more complex experiments can and hopefully will be started.
Sign up for AWS
AWS stands for Amazon Web Services. It's an umbrella term that stands for all the services Amazon provides, like EC2. In order to set up your own server, you need to sign up for AWS.
To do so, go here: http://aws.amazon.com/ -- in the upper-right corner you'll see a yellow widget that says Sign Up Now. Click it. It'll ask for your email address and Amazon password, as if you were buying a book or shirt.
Unfortunately I can't tell you about the next page, since I can't see it. I have already signed up for AWS. Hopefully it's not too confusing. If you have trouble, grab a screen shot and post it in a comment and we'll try to help out.
Sign up for S3 and EC2
After signing up for AWS, you must also sign up for S3 (the storage system) and EC2 (to create servers).
2. In the upper right corner is a panel called "My Resources" that lists the number of Running Instances, EBS Volumes, Key Pairs, Elastic IPs, etc. These are fancy names for computer stuff that aren't actually that complicated.
3. Click on Key Pairs. You should see an empty list. Click on the Create Key Pair button. A dialog pops up asking for the name. Enter the name of a place, like Tahoe. Click the Create button. Now something interesting happens. It wants to save a file on your computer. This file is a key that unlocks all the web services. Without this file you get nothing. With it you get everything. So you obviously want to put this in a safe place and take good care of it.
Create a security group
A security group is like the firewall in your operating system or router. It says what kinds of Internet messages can pass through to your server, and what kinds will be rejected.
1. In the left margin of the dashboard, click on the Security Groups link.
2. Click on "Create Security Group" near the top of the screen.
3. A dialog appears, asking for a group name and description. You can call it whatever you want, I called mine "mywebserver" and described it as "Server firewall settings."
4. Click Create in the dialog.
5. You should see your security group in the list. Click on it.
6. In the Allowed Connections list (lower part of the same frame) click on the popup that says "Custom..." to reveal a list of protocols. Choose HTTP then click Save. This will make it possible for your server to receive HTTP requests.
7. Do the same for HTTPS, RDP, SMTP and SSH; allowing your server to receive secure HTTP requests, control the server using Remote Desktop Connection on the Mac or Windows, send email, or use a secure shell.
Note: Remember to click Save after choosing each protocol.
Launch your server
Now it's time to create your virtual machine and launch it.
1. In the left margin of the dashboard, click on the AMIs link.
2. Type winopmlfirefox in the little search box near the top of the screen. A single item should show up in the list. Click on the checkbox next to its name.
3. Click the Launch button near the top of the screen.
7. Select your "Key Pair Name" from the list. (Mine is named Tahoe, yours might be too.)
8. Select both the default and mywebserver Security Groups.
9. Click the Launch button.
10. Pause for a moment to consider your accomplishment. You are now a Cloud Computing Expert. :-)
11. Click the Close button to close the big dialog.
12. In the left margin of the dashboard, click Instances. You should see a single entry whose status is "starting." We're now waiting for it to change to "running." This could take as much as 10 or 15 minutes, depending on how busy the angels and elves at Amazon are.
Notes...
Later if you want to go "shopping" for other AMIs, Amazon maintains a directory that's a bit like shopping for iPods or books, of popular AMIs. Too bad they don't offer the same reviewing options as they do for consumer products. (Consider this a feature request.)
In putting together the sample server for this tutorial, I started with Amazon's Basic Microsoft Windows Server 2003AMI with none of the frills.
Find or download Remote Desktop Connection
Remote Desktop Connection, or RDC, is an application for Windows or Mac that allows you to control a remote server like the one you just launched.
If you're using a Windows machine, RDC is in the Start Menu, Programs, Accessories.
After waiting, now the server is "running" -- we just have to kick it in the butt to get the server software launched. You do that by logging in the first time.
1. First, locate the Key-Pair file (mine is called Tahoe), open it with a text editor (Notepad on Windows, TextEdit on the Mac). Select-All. Copy. Close the file.
2. In the left margin of the dashboard, click on the Instances link.
3. Right-click on the instance you just launched. A popup menu appears. From the menu, choose Get Default Administrator Password.
4. A big dialog appears explaining what it means to decrypt your password. Click in the "Private Key" box and paste the text you copied in Step 1. Click the Decrypt Password button. It takes a few seconds, then...
5. A dialog appears with the server password. Leave it open so you can refer to it in the next steps. (If you know how, you might want to take a screen shot of this dialog.)
6. Launch the Remote Desktop Connection app from the previous section. Copy the address of the computer to the clipboard (in my screen shot it's ec2-72-44-33-187.compute-1.amazonaws.com). Paste it into the dialog that opens in the RDC app. Click on the wedge next to the word Options in the RDC window. Where it calls for the User name, enter Administrator. Then Copy the Decrypted Password from the dashboard, and paste it into the Password part of the RDC app.
7. Click the big Connect button in the lower-right corner of the RDC window.
8. If all goes well, you should see your server running in a window on your desktop. But don't be fooled, this virtual computer exists in the cloud, not here or where you are. It's somewhere "up there."
9. You should see a big window named OPML, this is the OPML Editor, it's running both as a static server, on port 80 and as a dynamic server on port 5337. In the next section we'll access both these servers in a web browser on your machine. You can close the RDC window, or leave it open, if you want to explore. It's just a Windows machine. :-)
Visit your server
1. In the left margin of the dashboard, click on the Instances link.
2. Click on your instance. (There probably is just one in the list.)
6. You should see Hello World, today's date, the time, the IP address of the server, and a counter that starts at 0, and increments every time you refresh the page, which you should do a few times to prove that it's a dynamic page.
Comments
You now have a server running. It's a customized version of the simplest Windows image on Amazon. I added two open source programs: 1. The OPML Editor (static and dynamic server). 2. Firefox (browser). It's a fully functional server, can run anything any of these programs can run. We're not talking kid stuff here.
If you want to try out some of the tools, like an RSS aggregator, or a Twitter archive app, bring the OPML app to the front and choose Tool Catalog from the Misc menu. A page opens in Firefox with the current list of tools you can install. I try to add to this list pretty frequently. All the tools have docs, and browser-based configuration.
Or it may make sense to shut off the server right away. The important thing is that now EC2 is not a mystery. Its purpose is to give you access to ordinary computers in a place where they're easy to get at through the Internet. The easier it gets, for more people, the more interesting things we'll be able to do, together.
How to turn off the server
As Amazon makes very clear, until you shut off the server, they're going to charge $0.125 per hour. So if you're done, here's how to turn it off.
1. From the dashboard, click on Instances. You should see one item, the instance we just launched.