|

Everyone talks about hosting services on AWS but how do you do it? I thought I would create a simple “how to guide” on how to build a wordpress website/blog on AWS. The guide has been created by SystemsUp to show an administrator start to finish configuration for building a website on AWS. The below is a recommendation but not the only way to setup WordPress on AWS so please consider your requirements. It is expected that the administrator is familiar with AWS.

SystemsUp can help you test and migrate your workloads to the cloud following our totally de-risked process with assuredDelivery™.

I would encourage you to drop us a line and get in touch with us for a no obligation chat.

So lets get down to the details….

 

The Mission

The below diagram will display what we are going to set out to complete

Phase 1 – VPC and Region Selection

As I have already built and configured this environment within the Ireland Region, for demonstration purposes, I will configure a new service within N. Virginia US East.

Creating VPC

Once you have logged into the AWS portal, select VPC from the main menu and double check you are in the correct region.

The below instructions will detail how to create a VPC.

– Select “Your VPCs”
– Create VPC

create-VPC

After this, you can filter your view for your new VPC

filter-VPC

Creating Subnets

Now we will need to create two public subnets and two private subnets. The public subnets will be used for the Web servers and the private subnets will be used for the Database Nodes. We wont be using both public subnets as we will only configure one web server but this could be used at a later stage if required.

– Select Subnets
– Create Subnet

subnet-1

– Repeat for the next three

subnet-2

subnet-3

subnet-4

Creating Internet Gateway

Now that the subnets have been created, we will need to make sure the public subnets have access to the internet. To enable internet access, we will need to create an Internet Gateway.

– Select Internet Gateways
– Create Internet Gateway

create-IGW

– Select “Wordpress” Internet Gateway

– Attach to VPC

attach-IGW

Route Tables

To enable a route to the internet, a new route table will need to be created. Follow the below to allow traffic from the Public subnet.

– Select Route Tables
– Create Route Table

create-route-table

– Select new route table
– Add the following route

route-table-01

– Now select Subnet Associations

route-table-02

Security Groups

Now the security group will need to be created to allow access to the resources.

Database Connections

– Select Security Groups

DB-create-SG

–          Inbound Rules

DB-SG-inbound

 

SSH Access

SSH-create-SG

– Inbound Rules

SSH-SG-inbound

  Web Access

Web-create-SG

– Inbound Rule

Web-SG-inbound

 

 Phase 2 – RDS MySQL Database

We will be configuring a MySQL database to sit within two Availability zones. This will be configured in case of a failure of an availability zone.

So let’s start the MYSQL instance. To begin, select RDS from the main menu and select “subnet Groups” which is down the left hand column.

create-db-subnets

Launch a DB Instance

Launch-db-01  Launch-db-02

Launch-db-03

Launch-db-04

Launch-db-05

This will take about 5 – 10 minutes to complete so best to go grab a drink while its creating your new DB. Once it has completed, it will look like this:

Launch-db-06

 

WordPress Server

Now we will need to build the WordPress application server to connect to the MYSQL database. Lets start with the below configuration:

– Select EC2 from the main menu and launch a new instance.

web-app-01

web-app-02

web-app-03

web-app-04

web-app-05

 

web-app-06

 

web-app-07

 

web-app-08

Assign an Elastic IP Address

– Select Elastic IPs
– Select “Allocate New Address”
– Select “Associate Address”
– Select the new instance you created

elastic-ip

 

Building WordPress Application

I prefer to use putty instead of the java console so I converted the .pem to a .ppk

To do this you will need to use “puttygen” & “putty”. These applications can be downloaded from – http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Once you have downloaded puttygen, launch the application for follow the below instructions:

– Select “Load”
– Change search for “All files”
– Select “.pem” and open
– Save private key
– Yes
– Name the ppk file and save
– Close puttygen

Now you can lunch Putty and configure the new connection.

– Launch Putty

putty01

Under SSH, Auth enter the .ppk location like below;

putty02

Return to “session” and save the connection with a name and open the connection.

putty03

Now we will begin to build the requirements for WordPress app.

> sudo su –
> apt-get update && apt-get -y upgrade
> apt-get install sendmail -y
> apt-get install mailutils -y
> apt-get install apache2 -y
> apt-get install mysql-client-core-5.5 -y
> apt-get install php5 php5-mysql libapache2-mod-php5 php5-mcrypt -y

> a2enmod rewrite
> service apache2 restart
> cd /tmp

Now we will need to download the latest version of wordpress and configure it with apache

> wget http://wordpress.org/latest.tar.gz
> tar -xzvf *.tar.gz
> cd /var/www/html/
> mv index.html index-old.html
> cd /tmp/wordpress
> cp -R * /var/www/html/
> cd /var/www/html/
> chown -R www-data *
> chgrp -R www-data *
> chown www-data /var/www/html/

After the above has been completed, you will be able to browse to your Elastic IP address with a browser to complete the install.

wordpress-01

 

wordpress-02

wordpress-03

wordpress-04

wordpress-05

wordpress-06

wordpress-07

wordpress-08

 

Well you’re all ready to build and configure your website now! You will need to register a domain name and point it to your Elastic IP address to enable host name lookups but this can be done when the website is ready.

We can now setup a simple alert if the instance fails a status check and an email notification.

To do this, go back to the AWS portal and select EC2. Highlight your web app and select Monitoring.

– Select Create Alarm

alarm-01 alarm-02

Hope you enjoyed the post.

 

Marc Esmiley – @MarcEsmiley

SystemsUp Ltd
Waterloo Business Centre
117 Waterloo Rd
London
SE1 8UL

Related Post