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 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.
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
After this, you can filter your view for your new VPC
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
– Repeat for the next three
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
– Select “Wordpress” Internet Gateway
– Attach to VPC
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
– Select new route table
– Add the following route
– Now select Subnet Associations
Now the security group will need to be created to allow access to the resources.
– Select Security Groups
– Inbound Rules
– Inbound Rules
– Inbound Rule
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.
Launch a DB Instance
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:
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.
Assign an Elastic IP Address
– Select Elastic IPs
– Select “Allocate New Address”
– Select “Associate Address”
– Select the new instance you created
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
– Name the ppk file and save
– Close puttygen
Now you can lunch Putty and configure the new connection.
– Launch Putty
Under SSH, Auth enter the .ppk location like below;
Return to “session” and save the connection with a name and open the connection.
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.
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
Hope you enjoyed the post.
Marc Esmiley – @MarcEsmiley
Waterloo Business Centre
117 Waterloo Rd