Launching A WordPress Multisite App On ECS

We’ve spent the past month learning about running the various AWS cloud services and configuring them to run our Store Locator Plus® SaaS platform. We now use AWS CodeBuild along with a supporting “Docker things” repository that work together to spin up mini Docker containers that then build Docker images for us. These Docker images contain the server and application stack needed to run our SaaS service. We tweak our code, push it to the repos for plugins or whatever, then tell CodeBuild to spit out a Docker image that runs the app.

Our Docker-In-Docker environment repository and our code repositories are all stored in AWS CodeCommit to reduce configuration and security barriers.

CodeBuild, ECR, and Our Docker Image

Our image is built on the aarch64 (MacOS M1 compatible Linux/ARM64) hardware where Amazon Linux 2 resides. On top of that runs PHP (8.x at this juncture) with some tweaks to the PHP environment and some added libraries (we will certainly need to add more before full production). On top of that sits WordPress running in a multisite configuration. Our custom code, the plugins, themes, must-use plugins, and other supporting files are all pulled in from independent git repos using submodules.

When CodeBuild runs this is all packaged up and pushed out into the AWS Elastic Container Registry (ECR) in a ready-to-run image. We can pull this down to our local dev box to play with things, or push it out to a staging or production cluster. Currently we are only playing with the developer version of things until the stack can be fully tested for possible production release.

Elastic Container Service

The container service has several layers that work together – the Task Definition which drives a Service which is part of a Cluster. These work together to pull in the Docker container image we pushed into the ECR to spin up a fault tolerant scalable cluster behind a load balancer that serves up our SaaS service.

Our Task Definition

Our general outline for a WordPress multisite container task has these key attributes:

Task definition family: myslp_webserver_dev


Type: Amazon EC2 instances
OS/Arch: Linux/ARM64
Network: awsvpc
Task size: 3 vCPU, 6.0 GB memory
Role: escTaskExecutionRole

Container – 1

Name: myslp2024-aarch64-container
URI: …<repo_name>:develop
Port: 80 (default)
Root: needs r/w for Apache
Resource Limits: 3 vCPU, 1 GPU, 6GB hard limit, 5.5GB soft limit
Environment Vars…

WP_HOST_URL=(our dev URL, not protocol, etc. just the part)
WP_HOME=full dev URL
WORDPRESS_CONFIG=long string of defines per the WP multisite configuration


This will be added later as it can cause issues with the Docker EFS driver. We do not need EFS mounted volumes at this stage, but will when we have shared persistent objects like customer-uploaded images.

Volume – 1
name: efs-uploads
Configure at task creation
Type: EFS
File system ID: <the EFS FS ID from a full copy of our live EFS file system)
Root Directory /

Add a Mount point…

Container: <container-1 from above>
Source volume: <efs-uploads from above>
Path: /var/www/html/wp-content/uploads

Our Cluster Definition

Name: myslp-cluster-dev


Type: EC2 Instances
Provisioning: On Demand
OS/Arch: Amazon Linux 2 (arm64)
EC2 Type: c6g.large c6g.xlarge
c6g.large 2vCPU / 4GiB ($0.068)
c7g.large 2vCPU / 4GiB ($0.0723)
c6g.xlarge 4 vCPU / 8GiB ($0.136) , free – m 6614
c7g.xlarge 4 vCPU / 8GiB ($0.1445)
Capacity: Min 2, Max 5
SSH Key Pair: <our existing SSH key>
Root EBS Volume: 30GiB

VPC: <existing slp cluster vpc>
Security Group: gwp-vpc-default


Existing Cluster: myslp-cluster-dev
Compute option: capacity provider
Strategy: use cluster default

Deployment Configuration
Type: Service
Task definition: Family myslp_webserver_dev, revision (auto = latest)
Service name: myslp-webserver-service-dev
Service type: Replica
Desired tasks: 1
Deployment type: Rolling (we will try blue/green later)
Running Tasks: Min 100% max 200%

Service Connect / Discovery / Networking
Leave at defaults

Load Balancing
Use application load balancer
Create New
Name: myslp-webserver-lb-dev
Health Check Grace: 180 seconds
Container to load balance: <default>
Listener: new, port 443 HTTPS, use existing ACM cert for *
Target Group: myslp-webserver-tg-dev, protocol HTTPS, health check HTTPS /VERSION.txt

Service auto scaling
Use service auto scaling
Min task: 1, max: 5
Name: myslp-webserver-scaling-dev
Metric: CPU, target 70, out cooldown 300, in cooldown 300

Image by Thomas G. from Pixabay

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.