This project creates the infrastructure and deployment pipeline to run a WordPress application on AWS.
- Amazon EKS: This is created using the AWS EKS Blueprints for CDK
- Amazon Aurora MySQL Cluster to store WordPress data
- Amazon Elastic File System (EFS) service to store WordPress installation and configuration files
Here's the high level architecture design:
- AWS VPC with multiple Availability Zones (AZs)
- EKS Cluster with a minimum of two nodes placed across different AZs
- Amazon MySQL Aurora cluster with two nodes (writer/reader) deployed across multiple AZs
- Amazon EFS file system. A regional storage classes that store file system data and metadata redundantly across multiple geographically separated Availability Zones within an AWS Region
- FluxCD to continuously monitor GitHub an and synchronizing the Kubernetes cluster using GitHub as it source of truth.
- Clone this repository
- Make the deploy script executable:
chmod 750 deploy.sh
- Execute the script
./deploy.sh
- Once the deployment completes, create a directory in the root of the project called
secrets
and create two files inside:
- kustomization.yaml
- namespace.yaml
apiVersion: v1
kind: Namespace
metadata:
name: wordpress
labels:
name: wordpress
secretGenerator:
- name: mysql-pass
namespace: wordpress
options:
disableNameSuffixHash: true
literals:
- dbpassword=
- dbhost=
- dbuser=
- dbase=
resources:
- namespace.yaml
- Make sure to add the credetials for the created database found in
AWS Secrets
- Set your kubernetes context by updating kubeconfig]. The exact command can be found on the CloudFormation Output tab.
- Apply the secrets to the EKS Cluster by running
kubectl apply -k /secrets/
- Next step is to install, configure and bootstrap FluxCD following the instructions here. This is an example of how to bootstrap flux:
flux bootstrap github \
--owner=$GITHUB_USER \
--repository=$REPO_NAME \
--branch=main \
--path=/k8s/prod \
--personal=true