Skip to content

johnweland/wordpress-on-aws

Repository files navigation

WordPress on AWS

The idea is to have a pattern that can be deployed which would result in a highly available, scalable, yet efficient WordPress solution.

It follows, roughly, the AWS WordPress architecture with some minor tweaks. Namely the adition of using S3 for static files and media that will be served up via CloudFront.

Another small change is that instead of being two (2) availability zones (AZs) and having two instances (one in each) being load balanced between. It can span N number of AZs but only have one running instance by default.

The autoscaling group however will ensure that atleast one is running at all times in any AZ that is available, but can spin up more instances as needed.

Conciderations

Currently this is planned to use EC2 instances, but a case could be made for Fargate Containers.

AWS CLI could be used a well to determine a few things. 1. How many AZs are in the target region? 2. What AZs have a given resource type available (not all AZs will have all of the same instqnce type availibility and/or capacity). Using the AWS-CLI we should be able deploy to N number of AZs where our requires instance type is available

Architecture Diagram

Proposed architecture diagram as of 8/26/2022

Services Used

Amazon Virtual Private Cloud (Amazon VPC), Amazon Elastic Compute Cloud (Amazon EC2), Auto Scaling, Elastic Load Balancing (Application Load Balancer), Amazon Relational Database Service (Amazon RDS), Amazon ElastiCache, Amazon Elastic File System (Amazon EFS), Amazon CloudFront, Amazon Route 53, Amazon Certificate Manager (Amazon ACM) with AWS CloudFormation via AWS CDK.

Suggested WordPress plugins

  1. AWS for Wordpress (hasn't been updated in a while but is directly from AWS)
  2. W3 Total Cache
  3. WP Offload Media (optional)

CDK Stuff

This is a project for CDK development with TypeScript.

The cdk.json file tells the CDK Toolkit how to execute your app.

Useful commands

  • npm run build compile typescript to js
  • npm run watch watch for changes and compile
  • npm run test perform the jest unit tests
  • cdk deploy deploy this stack to your default AWS account/region
  • cdk diff compare deployed stack with current state
  • cdk synth emits the synthesized CloudFormation template