With reference to my previous blog on:
1. AWS:How to create and activate a new account in AWS ?
I have made a scenario based “AWS services usage” blog in this content. Which can be considered as a Proof of Concept [POC] Project also.
If you are new for cloud technology, I have made a video cum blog for you to understand its initiation/evaluation concepts. This video is more useful for PMs/Cloud Architects/DevOps role based people.
For video Visit:
For the above video’s blog:
Now, let us move forward with this blog content.
In this AWS exercise, I have described/demonstrated on WordPress[WP] infrastructure creation using a free tier account.
At the end of this blog a micro level lab practiced steps are copied and a recorded video is there on my channel.
I would like to explain from architecture/design perspective through this blog, before you go to Lab steps.
After doing this exercise, simply and finally we can come into the following conclusions:
a) Creating a blogging infrastructure can be fully automated through AWS services.
b) Infrastructure can be created at any time on-demand without any up-front
commitment for how long we will use it in AWS.
c) We can pay for our infrastructure depending on how many hours we use it.
d) Infrastructure consists of several parts,
such as; i) virtual servers, ii) load balancers, and iii) databases.
e) Infrastructure can be deleted with one click without costing to us.
This process is powered by AWS automation. So it will not be billed to our free tier account after deletion!!.
First let us analyze on WP and its components.
How a WordPress infrastructure can be planned?
Assume we have a startup company, which publishes more white papers and blogs.
Assuming; our startup company currently uses WordPress[WP] to host over 500 blogs on our own servers. The blogging infrastructure must be highly available, because customers don’t tolerate outages of any servers. To evaluate whether a migration is possible through AWS services, we need to do the following three Activities planning and try out with AWS free-tier account:
A) Set up a highly available blogging infrastructure in AWS.
B) Estimate monthly costs of the infrastructure.
C) Finally, Delete our blogging infrastructure to save cost from free-tier account.
For our understanding on WP;
- WordPress[WP] is written in PHP and uses a MySQL database to store data.
- Apache is used as the web server to serve the blog pages.
- With this information in our mind, we map our requirements to AWS services to test the infrastructure creation.
Now, let us analyze on “what are the AWS services required for our WP test infrastructure?”.
We need the below AWS services to do this activity:
I. Elastic Load Balancing (ELB),
II. Elastic Compute Cloud (EC2),
III. Relational Database Service (RDS) for MySQL and
IV. Security groups.
Let us analyze what are the functions/benefits of these AWS services.
I. Elastic Load Balancing (ELB):
AWS offers a load balancer as a service.
The Elastic Load Balancer (ELB) distributes traffic to a bunch of servers behind it in a cloud environment. It’s highly available by default.
Let us assume our startup company’s blogs are published globally. From many countries these can be accessed by the users. Assume there are lot of users access this content globally. Then in traditional method your load is not balanced without having physical servers connected through VPNs/networks, etc. in different locations. Think about the Hardware/Software/maintenance/FMG cost for this traditional infrastructure. We can not think it being a startup company to spend much. No way!! Hence we need to depend on cloud service provider.
With AWS ELB, this can be balanced by distributing the blog users traffic to different virtual servers under cloud environment. To denote this distributed load balancing architecture, I have collected a diagram on;
WordPress infrastructure and Load Balancing through ELB AWS service.
Which is pasted here for your clarity on the ELB function.
II. Elastic Compute Cloud (EC2):
It is A virtual server which is provided by the Elastic Compute Cloud (EC2) service of AWS. We will use a Linux server with an optimized distribution called Amazon Linux to install Apache, PHP, and WordPress during our exercise. Please note; we are not limited to Amazon Linux only; we can also choose Ubuntu, Debian, Red Hat, or Windows. Virtual servers can fail at any time, so we need at least two of them for contingency planning. The load balancer will distribute the traffic between them. The beauty of AWS service in case of a server failure is; the load balancer will stop sending traffic to the failed server, and the remaining [contingency] server will need to handle all the requests until the failed server is replaced. Let us not worry on this communication! You will be intimated the status through alerts.
A sample architecture diagram is pasted here FYI with two EC2 instances.
III. Relational Database Service (RDS) for MySQL:
WordPress relies on the popular MySQL database. AWS provides MySQL as a Relational Database Service (RDS). We can choose the database size (like; storage, CPU, RAM), and RDS takes care of the rest (backups, updates). RDS can also provide a highly available MySQL database by replication. In traditional [non-cloud] model we had the similar setup. It occurs huge costing. By using AWS cloud services this can be easily maintained with minor costing only.
On this context; from the below diagram we can see the MYSQL features from AWS services offering.
V. Security groups:
In every application architecture we need to have the security features in place. Either these can be embed in the applications or through security tools it can be applied. So the entire architecture is protected that way.
But in cloud services many providers provide these services differently with their services offering.
The Security groups are a fundamental service of AWS to control network traffic like a firewall in traditional systems. Security groups can be attached to a lot of services like ELB, EC2, and RDS. For example; with security groups, we can configure our load balancer as below:
It only accepts requests on port 80 from the internet. Web servers only accept connections on port 80 from the load balancer. And MySQL only accepts connections on port 3306 from the web servers. If we want to log in to our web servers via SSH, we must also open port 22. Similar ways the architecture setup can be configured.
FYI, I have considered a diagram from AWS docs; which denotes a typical AWS multi-tier approach security services with a Firewall:
As shown in the above diagram, A security group acts as a virtual firewall for our instance to control inbound and outbound traffic. When we launch an instance in a Virtual Private Cloud[VPC], we can assign the instance to up to five security groups. It means in any VPC AWS provides five different security groups.
So, now what is our start company plan for security?:
Let us assume our startup company’s blogging infrastructure consists of two load-balanced web servers running a) WordPress and b) a MySQL database server.
The following tasks are performed automatically in the background through AWS:
- Creating an ELB.
- Creating a RDS MySQL database.
- Creating and attaching security groups.
- Creating two web servers.
- Creating two EC2 virtual servers.
- Installing Apache and PHP via yum.
- Install php, php-mysql, mysql, httpd.
- Downloading and extracting the latest version of WordPress from http://wordpress.org/latest.tar.gz
- Configuring WordPress to use the created RDS MySQL database
- Starting Apache.
Before going to the above steps, I would like to show the below diagram for your understanding on “The setup of WP hosting on AWS”. You can download it through the URL given and see it as an image file for your understanding.
Now, let us recap our beginning conclusions for this blog. We need to do the below activities till end of the exercise.
Creating a blogging infrastructure.
Analyzing costs of a blogging infrastructure.
Exploring a blogging infrastructure.
Shutting down a blogging infrastructure.
Deleting infrastructure from AWS Account.
1. What actions we need to consider for Creating blogging infrastructure in AWS?: To create the blogging infrastructure we need the below steps to follow on AWS console.
Note: Please note time to time the screen flows [micro level steps] might change on AWS, but the process should be the same to understand on creation of this WP infra.
- Open the AWS Management Console at https://console.aws.amazon.com.
- Click Services in the navigation bar, and click the Cloud-Formation service.
- Click on Create Stack to start the four-step wizard.