High Traffic WordPress website with Docker, AWS (ECS, Code Pipeline, Load Balancer, RDS, EFS) Complete Series
Tags: aws, docker, ecr, ecs
Published: 2020-02-05 05:17:32

---
title: High Traffic WordPress website with Docker, AWS (ECS, Code Pipeline, Load Balancer, RDS, EFS) Complete Series
published: true
date: 2019-12-12 10:25:04 UTC
tags: AWS,Docker,ECR,ECS
cover_image: https://s3-ap-southeast-2.amazonaws.com/sal-blog/wp-content/uploads/2019/12/26130911/Wordpress-Series.jpeg
canonical_url: ---

This series will help you with setting up Dockerized WordPress website on you local machine and fully automate the deployment process to Amazon Web Services.

The website will be ready for heavy traffic. To achieve this, I have created the following topics:

- **WordPress on AWS, the challenges**
- [Dockerize WordPress with themes, plugins and common configuration](https://dev.to/saluminati/dockerize-wordpress-with-themes-plugins-and-common-configuration-2am4)
- [Prepare AWS Security Groups for WordPress project](https://dev.to/saluminati/prepare-aws-security-groups-for-wordpress-project-5ebd)
- [Create IAM (User, Roles and Policies)](https://dev.to/saluminati/create-iam-user-roles-and-policies-pmm)
- [Create MYSQL database using AWS RDS](https://dev.to/saluminati/create-mysql-database-using-aws-rds-2p7j)
- [Create AWS EFS (Elastic File System) Plugin storage for WordPress behind Load Balancer](https://dev.to/saluminati/create-aws-efs-elastic-file-system-plugin-storage-for-wordpress-behind-load-balancer-3hm0)
- [Build and Push wordpress project to AWS ECR](https://dev.to/saluminati/build-and-push-wordpress-project-to-aws-ecr-2h7c)
- [Create Load Balancer for WordPress website](https://dev.to/saluminati/create-load-balancer-for-wordpress-website-4f8m)
- [Create Task Definition for WordPress Docker Project](https://dev.to/saluminati/create-task-definition-for-wordpress-docker-project-27dp)
- [Putting all things together using AWS Task Definition](https://dev.to/saluminati/putting-all-things-together-using-aws-task-definition-4n7o)
- AWS Codepipeline (Coming soon)
- Speed up your WordPress website for better SEO (Coming soon)

I know it sounds a bit harsh saying that WordPress is not civilized enough for AWS but hear me out !

I have been working with modern frameworks such as Rails, Laravel and reactJS for some time now. All these frameworks have evolved so much overtime and ready for multi environments, CI/CD, Load balancers and the list goes on.

Our main product is built on Rails and its fully automated with AWS CI/CD and other automation. Sound great isn’t it?

We recently decided to separate our behind the paywall application and content from each other. In simple words, our complex application (built in Rails) will stay as it is. On the other hand, for content such as blog, marketing pages and few other things such as recipes will be on WordPress.

I will take you through the journey of the whole process and lessons I have learnt during this process of making WordPress shine on AWS with CI/CD, Load balancers and how much WordPress is not ready for that transition by default.

So Let’s make WordPress up its game !

Let’s begin with the challenges I have faced and then you can make the call if these are the right series of tutorials for you or not.

## 1 | Load balancer and bloody plugins 

We all love the fact that on WordPress, we can install plugins without a deployment. Here’s the challenge with this approach, if your WordPress website is behind a Load balancer and there are multiple instances running. You will be installing the plugin only on the instance you are connected to. It will crash for the users who are connected to other instances.

One simpler solution is to deploy the WordPress website again with the plugin included. It takes away the freedom of installing or un-installing a plugin without a redeployment.

[AWS Elastic File System (EFS)](https://aws.amazon.com/efs/) is our answer, we will simple mount the plugin directory of WordPress instances to our EFS. Please take a look at the diagram below:

![](https://s3-ap-southeast-2.amazonaws.com/sal-blog/wp-content/uploads/2019/12/27021517/FI-2-1024x682.jpeg)

AWS EFS is not just highly available, its IO operations are blazing fast. Don’t worry it won’t slow your website down at all.

## 2 | Centralized MYSQL Database

Most of the people are probably using AWS RDS already with their WordPress websites. We will be using the same too. Just a centralized database for WordPress website behind Load Balancer.

## 3 | De-couple variables stored in Database and DO NOT configure the Apache or Ngnix every time

Simple as it sounds, variables such as SITE\_URL will not be stored in MYSQL database. You know we always have to configure Apache or Ngninx for the wordpress websites.

A lot of people create/use [Amazon Machine Images (AMI)](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html) for that purpose. the only problem with using AMI is configuration changes. You will have to create a new AMI on every change you make. Damn what a waste of time.

We will have a boiler plate WordPress Docker template which can kick start any WordPress website in minutes without configuring Apache, Ngnix and other settings.

## 4 | Website performance and SEO challenges

There are so many plugins available for WordPress website performance boost. I will share the ones I have used and what have worked for us in the end.

## 5 | AWS Elastic Container Service 

Finally, How to use [Amazon Elastic Container Service](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/Welcome.html) which includes the following:

- [Amazon Elastic Container Registry (ECR)](https://aws.amazon.com/ecr/)
  - Our Docker build repository that contains our most recent Dockerized WordPress project with all the server configurations
- [Amazon ECS Task Definitions](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html)
  - This is where we use our Docker build and put all the variables for our WordPress website; Remember we’re not keeping our website variables in the database.
- [Amazon ECS Clusters](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html)
  - This is where it creates the EC2 instances of your WordPress website using the ECS Task Definitions.

#### 

#### Next

**[Dockerize WordPress with themes, plugins and common configuration](https://dev.to/saluminati/dockerize-wordpress-with-themes-plugins-and-common-configuration-2am4)**