Nick Cavarretta

Internet Marketing Blog Posts

Here are my rantings on internet marketing. I've given some good advice in some articles, and others, well. Take a look for yourself.

Host Your Website In The Cloud Using Amazon Web Services

Heard of Amazon Web Services with EC2 and Route 53? This article will go over everything you need to know about deploying an instance on AWS EC2, Installing WordPress using Bitnami and a quick guide on how to use SSH for making some adjustments.

There are some prerequisites for this article: you should already know a little bit about setting up domain names, web services and how to use SSH Console. During this article I’m going to assume you’re using a Windows OS and are familiar with web projects.

Step One – Preparation

If you haven’t done this kind of task before, you will most likely need to download and install a few programs.

Install Putty –
Create an Amazon Web Services Account –
Buy Your Domain Name – (you don't have to use Godaddy)

Before we continue, we will need to go over our requirements before choosing how to move forward.

We want to have:

  • Email (Send/Receive)
  • WordPress Installation
  • DNS Management

Now we know what we want to do, let’s start looking into how it’s done…

Note: AWS Email Services only work in three regions: US East (N. Virginia), EU (Ireland) and US West (Oregon).

Step Two – Setup Your Server

  1. EC2 Section
  2. Launch Instance
  3. Select AWS Marketplace, search WordPress
  4. Select WordPress by Bitnami
  5. Use T2 Micro Machine (free tier)
  6. Configure Details , Auto-assign IP = Enable
  7. Launch Instance
  8. Create SSH Key Pair, download key *.pem file and keep it

To manage the server, go back to EC2 and select instances. You will need to wait for the server status to have green ticks.

The next thing you need to do is find your WordPress login details.

  1. Goto Instances in EC2
  2. Right click on Instance, System Setting, System Log
  3. Save your password in a safe location

Note: If you see nothing in the system log then you need to restart the server. Right click in the instance and select Instance State and Reboot. Wait until the server is back online.

  1. Copy websites IP Address
  2. Paste IP in browser to see if the website is live
  3. Your username will be “user” and your password is what you copied from the system log

Once you’ve gone through all that, now it’s time to add the domain name to the server. You’re going to need to create a Hosting Environment inside Route 53 on AWS.

Step Three – Setup DNS

At this stage you should have an EC2 instance deployed with Bitnami and WordPress installed on the server which is accessible via your IP address.

Next we need to create our DNS environment.

  1. Goto Route 53 on AWS, Goto Hosted Zones
  2. Click Create Zone button
  3. Add your domain name, Public Hosted Zone
  4. Create A Record (leave name blank, add IP into Value)
  5. Create CNAME Record (name is www, Value is root domain)
  6. Copy 4 nameservers provided by AWS
  7. Configure your DNS settings in your registrar with custom nameservers

Here you will need to wait a little while… Generally hosting companies will tell you propagation takes up to 48 hours, but I think Amazon has some priority so it usually only takes up to 10 mins.

You can check to see if the domain brings your AWS IP Address across the world.

Once everything is looking good, you need to set a preferred domain name. This is where Putty comes in… We will get to that once we setup Putty and have SSH access.

Note: If you’re looking to install WordPress onto a server just to play around, then you can actually stop the tutorial here and start playing with your website. If you want to go for the full setup then see next steps.

Step Three – SSH Access

This is the part where you can start to see some console action, but first we need to make sure we have server access.

Setting up Putty for AWS access requires some conversion of the key. Let’s go through it…

If you installed Putty in it’s full, you will see the program group within the Windows Start menu. Go into that and select the PuttyGen tool.

  1. Load your existing private key by pressing the Load Button
  2. Select the PEM key from AWS
  3. Save the import data as a putty key (Save Private Key)
  4. Choose a passcode and remember it
  5. Close PuttyGen and load Putty
  6. You will need three things:
    1. host name (connection)
    2. username (data)
    3. authentication file (Auth)
    4. Save the session so you don’t need to do that again and connect and enter your passcode when asked.

Note: You can find those details by clicking on the connect button in EC2 on AWS. You will see some information popup. Use the information displayed and enter it into Putty.

Once you have connected to SSH via console, you should be able to start configuring your server settings.

Step Four – Inside SSH Console

Now we’re in, let’s start adjusting some settings. There are two main things we need to do in here right now.

  1. Remove the Bitnami Banner
  2. Set redirect to preferred domain (avoid duplicate content)

Firstly let’s remove the banner from displaying.

Log into your Bitnami console

Enter this line of code:
sudo /opt/bitnami/apps/wordpress/bnconfig --disable_banner 1

Now we only want AWS to serve the WWW version of the website and redirect the root domain to WWW. How this is done is by configuring a file…
sudo nano /opt/bitnami/apache2/conf/bitnami/bitnami.conf

Scroll down and you’ll see a section that starts like VirtualHost_default_:80
Underneath that, enter this code to set the redirect.
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Now restart your apache server:
sudo /opt/bitnami/ restart apache

After all that, check to see if the redirect has worked by trying to access your root domain in a browser, if you redirect to the www version of your site and the Bitnami banner is gone, then we can move onto the next section.

Type EXIT to leave the console…

Step Five – Setting Up Email Server

We’re just over halfway there, now we’re going to make sure we can receive and send emails. This is important if we want to move onto the next section.

In your AWS console look for Email and select WorkMail.
Leave Route 53 open in a new window.

  1. Add your organisation (wait for ok status to click further)
  2. Verify Domain Name (Add domain)
  3. Follow Steps to Add TXT to Route 53
  4. Once verified, add MX records (5 record sets)
  5. Goto USERS, Create USER
  6. Go through wizard to setup email
  7. Get Webmail login from Organization Settings

You can now login to your email by entering your username only and your password. You won't login if you add the @domain extension when trying to login.

At this stage you should have a live website on Amazon Web Services using Ec2 to host your website, Route 53 to manage your DNS and WorkMail to send and receive emails.


My Opinion About AWS

Now that you know how this is done, I don't recommend using it if you're looking for a budget solution. Using AWS can work out to be expensive for simple website usage. AWS is really for websites looking for cloud hosting that is simple to scale up when it's required.

If you're a small to medium sized business looking to host a website, then I don't recommend any cloud hosting solution, you can easily achieve the same goal at half the cost by using companies like NetVirtue and selecting cPanel hosting.

Leave a Comment