It called Elastic Cluster Services (ECS) which come with the Task Definition and Services setting then can be setup to has some part exposed to outside world via Application Load Balancer (ALB).
The database is running on Amazon Relational Database Service (RDS).
The user uploaded images is hosted on Amazon Simple Storage Service (Amazon S3) combined with a wordpress plugin called WP Offload Media Lite. While the whole wordpress codebases is stored on Elastic Filesystem (EFS) then mounted via Network File System (NFS) on each instance.
And all these are available for FREE because it is part of AWS Free Tier.
(first one year).
Except if you somehow scaled the Amazon Elastic Compute Cloud (Amazon EC2) in “ECS
Roughly, here is the receipt on how to setup ECS with RDS, EFS and S3 that would work with vanilla wordpress.
1. Setup a new AWS account (so that you will be eligible for the Free Tier)
– this will need a new credit card that can be charged on overseas.
– I opted to a call from AWS to verify the contact number instead of the SMS.
2. Setup the VPC that split between “Public Subnet” and “Private Subnet”
– Because you will not wanting any of your ECS task being assigned a Public IPv4 address upon spinning up.
3. Setup Subnets and its NAT Gateway for the privates ones.
– you will need at least two of them each, to support the High Availability Zone.
4. Setup RDS with the internal access only allowed.
– set with security group that allow connection to 3306 port
– from your defined subnets.
– I just select MySQL 8.0.21 for the version running on t2.micro/10Gb (Free Tier)
5. Setup S3 bucket
– that will sit in the public subnet and allowed public access to its.
6. Setup EFS
– I just set the minimal size for this as per Free Tier.
– this should sit in the private subnet and allowed only your private subnets IPs to access it.
7. Create an IAM policy roles
– that will be able to use S3 and EFS infrastructure.
– should be able to read/write the S3 bucket
– should be able to mount/read/write the EFS
8. Setup Application Load Balancer for port HTTP and HTTPS (port 80/443)
– the target should be IPs on the ECS instances -> Task.
9. Setup the ECS Cluster infra
– Set it to be tied to your VPC and Subnet (public)
– For this one I just select t2.micro
– for the setup, you want to tied this your public subnet first instance to ensure everything can
– set to run with key/pair for SSH access in cases need to debug it.
10. Setup the ECS’s Task definitions.
– here you should be able to add the EFS endpoint and mount it to “/var/www/html”
– Set the image source to point to wordpress:latest
– Define the working directory to “/var/www/html”
– Define the Docker variable of WORDPRESS_DB, WORPRESS_HOST, etc
11. Setup the Service from the Task.
– Here will be set the option to point to Application Load Balancer.
– that will be updated with latest target whenever new task is running.
12. Setup the security group for the ALB
– Set the certificates for the HTTPS
– and allow public access to it. port 80 and port 443.
Now let’s go into detail for each step.
1. Setup AWS account and activate it.
Once you have created a new AWS account.
-Activate it and add the default payment method.
2. Setup the VPC.
Once successfully activated new AWS account.
The only different between these two is one didn’t have direct access to Internet via Internet Gateway.
And it would be assigned with a IPv4 Public IP Address.
You may want to disable the NAT gateway in the private subnet if it does not require internet access.
Please also enable DNS hostname and DNS resolutions because it is needed for the EFS to work later.
Once the VPC is ready. You may start to create all the components needed for the ECS to work.
3. setup the Database into RDS
and assign necessary security group with proper access to the database port 3306.
4. Setup the S3 bucket.
5. Setup the EFS.
Then setup the EFS into the private subnet as well.
Then add it into the container setting.
Ensure it can be successfully manually started and status is changed to “RUNNING” before proceed with the next step.
10. Setup the Services and map it to use ALB.
12. Setup CNAME into DNS and point it wordpress and Install WP plugins.
Just need to be careful as it may cost extra buck with additional instance running.
You can always check the Billing tabs for the expected charged.
Ensure that you also cleaned up unused resources as it may also cost you extra.. like the unused IP allocation address. :)
Anything else you would like to add, feel free to put into the comment box below.