AWS Free Tier: Setting up a Free Web Server

AWS Free Tier: Setting up a Free Web Server
Page content

In the last few articles discussing the cloud, we covered what the ‘cloud’ really is and a roundup of current Infrastructure as a Service providers (IaaS). In this article, we will use one of those IaaS providers –Amazon Web Services (AWS)– to set up a free web server and show you just how easy it is to start using the cloud.

AWS

The first thing we need to do is setup an AWS account. After that, we’ll set up an instance and configure it to serve web pages.

Here’s how to create the account:

  1. Navigate to aws.amazon.com and click the Signup button.
  2. Follow the onscreen instructions to log into an existing Amazon account or set up a new account.
  3. Note that you will need to add a credit card to the account. If you use more resources than are allocated to the free tier, they will charge you.
  4. Next, you will need to verify your identity by telephone. Follow the onscreen instructions to complete the process.
  5. Keep the support plan at the Basic (free) level and click Continue.
  6. That’s it! Now, click the link to launch the AWS Management Console. This is where we’ll interact with and create our web server (Figure 1).

Figure 1: Signup Complete

The AWS Console

It’s going to be a bit daunting to log into the AWS console for the first time (Figure 2). There are about 30 options to choose from, but luckily, we’re just going to focus on one to start with. Click EC2.

EC2 stands for Elastic Cloud Compute and as you can probably guess, this is where we’ll set up our server instance. Amazon offers a free tier of EC2 for people just wetting their feet. You can keep the machine on all month without charge as long as you select the free tier. Amazon offers this for the first 12 months. After that, you need to pay up or find something else.

  1. On the EC2 dashboard, click Launch Instance (Figure 3).
  2. A guided walk-through will pop up letting you choose your AMI or Amazon Machine Image. Essentially, this dictates the operating system your machine will use. Note the options eligible for the free tier. Let’s select the Amazon Linux option – 64-bit.
  3. On the instance type, select Micro Instance. Again, you should see that it is eligible for the Free tier. Click Next to configure.
  4. On the Configure Instance tab, leave the defaults and click Next to add storage.
  5. On the Storage tab, click Add New volume and make sure EBS is selected. You can add up to 30GB of EBS storage for the free tier.
  6. Click Next twice so you are on the Security Group tab.
  7. SSH should already be allowed. Click Add Rule and select HTTP. Be sure Anywhere is selected for the source. This means our server will accept traffic on port 22 (SSH) and 80 (Web – HTTP) (Figure 5).
  8. Click the Review button and when ready, click Launch.
  9. Next, you will be asked to create a new key pair. Keys are needed to give you access to your server’s console. Select the option to create a new key pair. Give the key a name and click Download Key Pair. Be sure to save this file somewhere safe – and be sure to back it up! Once done, click Launch Instance.
  10. Click the Instances button to go back to the EC2 dashboard. After a few minutes, you will see the instance state change to “running.” Once it’s running, we can connect and continue.
  11. Before we continue, we want to take note of the public DNS and IP address, as we will need this to connect in the next steps (Figure 6).

Images

Figure 3: EC2

Figure 4: Add Storage

Figure 5: Security Group

Figure 6: Running Instance

Connecting to the AWS Instance

Now, we’ll connect to our virtual machine in the cloud using the public DNS address and key we downloaded earlier.

  1. Download and install PuTTy – a simple terminal program that will allow us to connect via SSH.
  2. Start PuTTygen. We’ll use this to convert the key we downloaded earlier into something PuTTy can read. Make sure SSH-2 RSA is selected and click Load (Figure 7).
  3. Browse for the .PEM file you downloaded and click Open. You should receive a notice that it was successfully imported.
  4. Click Save Private Key and click Yes on the warning that pops up.
  5. Give the key the same name as the original key (PuTTy will append a PPK extension) and click Save.
  6. Once done, close PuTTygen and open the PuTTy client.
  7. Enter the IP address or DNS name of the host and make sure SSH is selected.
  8. Next expand the Connection tab and then SSH. Click Auth and browse for the PPK file we created with PuTTygen.
  9. Click Open and click Yes to the security alert.
  10. Enter the username ec2-user and…. we’re in (Figure 9).

Images

Figure 7: PuttyGen

Figure 8: PuTTy

Figure 9: PuTTy

Configuring Our Instance

Now that we have our virtual machine up and running and can connect to it, we’ll want to install the HTTP daemon and run updates to make sure our machine is secure. To do this, we’ll use a package manager called “yum.” First we need to gain administrative access to the machine. We’ll use a command called Sudo and then run yum to update and install packages.

  1. Type sudo su at the shell prompt. You should now see the shell say “root@ip address#”. This means you are now root.
  2. Type yum install httpd nano. This will install httpd – the HTTP daemon and nano – a text editor. After a second, it will show you the packages that will be installed and will ask for permission to continue (Figure 10). Type y to confirm.
  3. Once the packages have finished installing, we will need to start the web server. Type service httpd start. You should see confirmation that the service has started.
  4. Now, let’s create a simple index file that we can test with. Type cd var/www/html/ and hit Enter.
  5. Type nano index.html.
  6. We’ll just put together a very simple example. We’ll need to use HTML, HEADER and BODY tags to create our page. See Figure 11 for an example. Click CTRL+O and then Enter to save the file then CTRL+X to exit.
  7. Now is the time for the big test! Open up a web browser and navigate to the IP address or DNS name of the instance. You should see our test page pop up (Figure 12)!

So now that it works, where do we take it from here? Well…. you now have a free web server (for a year). The options are limitless. Logical next steps would be to sign up for a domain name from a reputable registrar such as GoDaddy. Once you have a domain name purchased, you can easily configure DNS for your domain to point to your instance IP address.

Since we only installed the basic HTTP Daemon, the types of web content we can publish is limited. You may want to install a LAMP stack (Linux, Apache, MySQL, PHP) so you can deploy full-blown applications.

Good luck and have fun with your new web server. Just be sure to pay attention to when that free tier through AWS is up!

Images

Figure 10: yum

Figure 11: Index File

Figure 12: Test Page

This post is part of the series: Basics of Cloud Computing

An overview providing basic details on the definition of “the cloud” as well as services available on the cloud.

  1. Understanding the Cloud - IaaS, Paas, DRaaS and Saas - Oh My!
  2. Infrastructure as a Service Provider Roundup
  3. How to Set Up a Free Web Server Using Amazon Web Services