How To Set Up a Cloud Webserver on Amazon Web Services

Photo of author

Doug Reid

Introduction

Amazon Web Services Logo

In my previous articles [Introduction To Small Cloud Computing – Part 1, Introduction To Small Cloud Computing – Part 2] on Cloud Computing, I discussed some of the terms and options of cloud computing. To really understand cloud computing, though, I found it helpful to get hands-on experience.

This article is intended as a basic guide to starting and accessing a cloud computer. I found going through these steps demystified the concept of cloud computing for me. I’ve played around with various Linux and Windows servers before, but the idea of having a computer run in the “cloud” seems like there must be something advanced about it. As with many technologies, once you get the hang of it, it isn’t as hard as it initially seems.

I’m using Amazon Web Services (AWS) as my public cloud computing supplier. As discussed in my previous article, there are many other providers. Amazon is one of the more well known and mature platforms for cloud computing. Amazon offers multiple cloud computing services; I’m using the basic cloud computing service called Elastic Compute Cloud, or EC2.

The outline of the process I followed is:

  • Set up an AWS account
  • Create a server instance
  • Configure the instance
  • Connect to the instance and configure it

Step 1: Set up an account on AWS You’ll need to create a user name and password, address, as well as enter a credit card for billing information.

Step 2: Create an Instance

a) Click Launch an Instance. An instance is a cloud computer, which is a virtual machine. Instances are launched via the Amazon EC2 tab. Clicking this option starts the process for choosing options of your cloud computer.

b) Select your instance Type. You can select Windows and Linux instance types. I’m going to use Linux. There are several different Linux servers you can fire up, as well as Windows servers as shown in Figure 1 below. I selected a Fedora LAMP Web Starter (LAMP = Linux, Apache, MySQL, Perl) server.

Instance types

Figure 1: Instance types

Under Launch Instance, I chose a simple billing option for pay by the hour cloud computing. I also chose to start my cloud computer with just a single core CPU instead of a dual core CPU, which is cheaper.

Step 4: Generate and download a key pair. This step is essential to securely access your cloud computer. In this step, you generate a special file, which is a .pem file, that you’ll use to authenticate and log into your machine. Make sure your browser allows for file downloads before you proceed through this step. You’ll need to keep this file handy to connect to your cloud computer, which I’ll describe shortly.

Step 5: Configure the Firewall for your cloud computer. In this step, you’ll specify the ports that will be open on your server. For a LAMP server, the default firewall configuration is to open ports for SSH, HTTP, and MySQL, which opens ports 22, 80, and 3306.

All of the above steps have customization options. For example, you can launch an instance without the security of a key pair. Further, you can customize the firewall to allow access via more ports than the ones listed in Step 5. I stuck with the basics.

Upon completing these steps, simply click Launch. When you do so, Amazon will build your cloud computer and turn it on. It took just over a minute for Amazon to generate my virtual machine and boot my server. The EC2 Dashboard shows my running instance below.

EC2 Dashboard

Figure 2: EC2 Dashboard

I now have a running instance, or cloud computer, on Amazon’s Elastic Cloud Computer (EC2) service. The above steps seem pretty easy, and in fact they are. In fact, I found it more challenging figuring out how to connect to my new cloud server than setting it up.

Obviously, to do anything with your cloud computer, you need to log into it. Right clicking on your instance, you can select the option to Connect, which displays the screen show in Figure 3.

AWS connect screen

Figure 3: AWS connect screen

The Connect option doesn’t really connect you to your cloud computer, it just provides you with these instructions. For me, the instructions didn’t sink in, so I’ll walk you through what I did.

The instructions tell you to access your machine via SSH. Secure Shell, or SSH, is a fast and secure means of accessing the command line of a Linux or UNIX system over a network, as it encrypts all packets of the transmission.

I found two ways to ssh to my cloud computer. Method one is via a local Linux PC. Method two is via a Windows PC using Putty.

Connecting via Linux

Linux natively supports ssh. If you have a Linux PC or VM (virtual machine), this method is straightforward. I use the free VMWare Player software to run a Linux VM on my Windows PC.

To connect to your cloud computer via Linux, there are four steps.

  1. Boot your local Linux machine. I began by running the VMWare Player program and starting a Linux VM on my laptop.
  2. Copy the *.pem file I downloaded back in Step 4 to your Linux machine. I copied the file from my Windows PC to my Linux VM by putting the *.pem file in a shared folder on my Windows PC. My file was called dreid9.pem.
  3. Follow the step listed in the Connect instructions from Amazon. Enter the command chmod 400 dreid9.pem on the command line on your Linux machine.
  4. Enter the ssh command given in the Example shown in Figure 3. The command I entered was
    ssh -i dreid9.pem [email protected]
    .
    This connected me to my LAMP server, as shown in Figure 4 below.

Logged in via SSH - Linux

Figure 4: Logged in via SSH – Linux

The ssh command seems complex, but makes sense if you break it down. The command I entered told my computer to use the dreid9.pem file for authentication, use root as the user name, and the address of my cloud machine is ec2-184-72-207-244.compute-1.amazonaws.com.

My cloud computer doesn’t have a Public IP address, it has a publicly resolvable name. In my case, the resolvable name of my cloud computer is ec2-184-72-207-244.compute-1.amazonaws.com. The name is a bit cumbersome, but copy and paste saves the typing.

At this point, I am now securely connected to the command line of my cloud computer with full root privileges. My cloud computer has a network interface, memory, disk space, a processor, and I can configure to be a web server, run MySQL and Perl scripts.

Connecting via Windows

Windows doesn’t natively support ssh, but you can access your cloud computer via a Windows PC using the free software called Putty. You’ll need both Putty.exe and Puttygen.exe to access your cloud computer via Windows. Both are available here.

To connect to your cloud computer via Windows, there are four steps.

  1. Run puttygen.exe on your Windows PC. Select the option Load an existing private key file. When you select this option, you can browse your hard drive for your *.pem file. You’ll have to select the option for all file types for puttygen to find your *.pem file. Once you’ve selected your file, select the option to save private key. I saved my file as doug.ppk.
  2. Run putty.exe.
  3. Go to the Putty Category pane on the left, expand Connection and SSH and select the Auth option. In this option, browse to the *.ppk file you just created, as shown in Figure 5.

Configuring the Putty key

Figure 5: Configuring the Putty key
  1. Point to the resolvable name of your cloud computer via the Session option at the top of the Category pane on the left of the Putty program. In the Host name field, paste the resolvable name of your cloud computer. In my case, it is ec2-184-72-207-244.compute-1.amazonaws.com. Give this connection a name, I called mine AWS, and saved it, as shown in Figure 6.

Saving the putty session

Figure 6: Saving the putty session
  1. Highlight your newly created session. I called mine AWS. Click Open. Putty will now set up an ssh session with your cloud computer. You’ll be prompted to enter your user name, which is root, and you’ll be at the same level of access as via Linux as displayed in Figure 7.

Logged in via SSH - Windows

Figure 7: Logged in via SSH – Windows

Although there a few more steps to get Putty running versus Linux, I find using Putty more user friendly. Accessing my cloud computer is now point and click. I just launch Putty, click on my Saved Session called AWS, and click Open.

Using the Server

Whether I use Connect Method 1 or Connect Method 2, I can log into my own real computer running in the cloud and have complete root level control over the machine! The machine is a full working (virtual) server with a CPU, Hard Drive, Memory, and a Network Interface.

Using some basic Linux commands, I was able to determine my cloud computer is running on an Intel Zeon 2.66GHz CPU with 1.7GB or RAM and 10GB or hard drive space, shown in Figure 8.

cpuinfo command result for the cloud server

Figure 8: cpuinfo command result for the cloud server

In addition to the above hardware specs, my machine has full network access. From the command line of my cloud computer, I can ping other devices and network addresses, verifying I have Internet access. The IP on my cloud computer is 10.202.254.48 /23, which is a private IP address. For an additional fee, though, I can assign a public IP address to my cloud computer.

One of the main functions of a LAMP server is to host web pages. The AWS LAMP cloud computer is pre-configured with Apache, MySQL, and Perl running. I don’t claim to be an expert on Apache, MySQL, and Perl, but a simple test is to browse to my cloud computer’s DNS and see if I get a web page.

Indeed, browsing to http:// ec2-184-72-207-244.compute-1.amazonaws.com gave me the web page shown in Figure 9, which displayed the various status and version information about the software and configurations running on my cloud computer.

default AWS cloud server web page

Figure 9: default AWS cloud server web page

If I were a web designer, I would now be able to start customizing my cloud web server. I could add or modify web pages as desired. Using scp (secure copy protocol), I could upload web pages to run on my cloud computer.

Conclusion

There you have it, I set up a cloud computer on Amazon’s network. I used the basic options, which are best for development and test purposes. As such, I only scratched the surface of the products available on AWS, which include Computing Services (EC2), Content Delivery, Databases, E-Commerce (FWS), Messaging (SQS), Monitoring, Private Cloud, Payment Services (FPS), Storage (S3), Support, Web Servers, and Workforce solutions.

All told, running this machine for a little less than 24 hours cost $1.49. Note, however, that I used very little bandwidth, which is charged on an as-used basis. Since I didn’t need to continue to run the machine, I selected terminate from the AWS console. This deleted my cloud computer to stop all future charges. Since I’m not really using the machine, I had no need to keep it running.

Had I done any work or configuration on my cloud computer, I could have copied and saved my configurations for future use. When the time comes for future use, I simply need to fire up another instance and reload my configurations.

My goal was to document the steps to get started with cloud computing. I have to admit, I was a bit intimidated by the whole concept of cloud computing. In the end, though, it really was quite simple.

Related posts

Nefsis Offers Cloud-Based HD Video Conferencing

Nefsis has announced a HD Promo Pack to showcase its multipoint HD video conferencing solution.

Private WiFi Reviewed

Private WiFi is a new VPN service with bugs to fix.

Is A Cloud MarketPlace For You?

It can be tough to assemble the right cloud services for your business on your own. Fortunately, you don't have to go it alone.