What's the Best Way to Optimize WordPress Docker Containers on AWS?

June 11, 2025 5 answers
Asked by Tram conductor~!
I'm currently working on developing WordPress websites for my company, and we recently transitioned to using containers on ECS Fargate from a more traditional EC2 setup. Over the past year, I've learned quite a bit about infrastructure and deployment through initiatives like The Cloud Resume Challenge and AWS Cloud Practitioner courses. In my current setup, I've established a full VPC with RDS for databases, EFS for uploads, and ECS Fargate services for each website, alongside utilizing a modified Bitnami WordPress-Nginx docker image. I've integrated a CI/CD pipeline with GitHub Actions for automating plugin updates. However, I'm facing challenges with cost; each Fargate task can become pricey. Now, I'm considering switching to EC2 with ECS to potentially cut some costs while keeping the same overall structure. I'm curious to hear advice on improving this architecture or deployment strategy. Is moving to EC2 a good idea, or should I look into other alternatives like EKS? Any insights would be appreciated. Cheers!

Answers

prism.angle.42
If you're sticking with AWS but looking for alternatives, consider Google Cloud Run! It could simplify some of your processes. I have a personal project there, and itโ€™s running pretty smoothly!

_dry erase marker: Thatโ€™s cool! Iโ€™m using AWS for work currently, but definitely keeping GCP in mind for future projects since it offers some unique features.

Reply to this answer
Curlew
That sounds like an interesting journey! I did something similar recently with customers on CPanel, and I migrated them to AWS for better scalability and reliability. I used Cloudpanel and implemented custom scripts to manage EFS for shared storage. By keeping it behind an ASG with an ALB, we ensured that scaling is smooth when needed. Just a heads up, I found Varnish and Redis to be game-changers for performance, especially for page caching and object caching respectively. Have you thought about any of these solutions?

foghorn listener: That setup sounds effective! Itโ€™s great to hear how youโ€™re leveraging EFS without performance issues. For your concern about EFS performance, using caching layers like Redis can make a big difference, especially with multiple client websites. I also wonder if you considered how updates between instances are managed with shared storage.

library card holder: Sounds like a solid plan with your migration! Just make sure to monitor your EFS activity โ€” from my experience, syncing files can get a bit tricky, especially if multiple instances are trying to access the same resource.

Reply to this answer
dough..rises
Have you considered managed hosting solutions like WP Engine? They can save you a lot on costs and headaches related to infrastructure management. But, I get it โ€” if you prefer having control over container management, that might not be your ideal route.

scrapbook keeper: That's true, but the thing is with 50 client websites, managing updates across all of them was an issue with a managed solution. Building new images for deployment gives much more control in my case.

Reply to this answer
quill sharpener
Have you thought about using AWS App Runner? It's designed to make it easier to manage containerized applications and could simplify your stack compared to running everything through ECS/ALB.

dry humor: That sounds potentially simpler, but isnโ€™t App Runner a bit pricier? I'm already facing budget constraints!

Reply to this answer
_happy_to_help_
Your progress is quite inspiring! From what you've shared, Fargate does offer a lot of conveniences, but the costs can stack up, especially when scaling. Transitioning to EC2 could give you more control but requires managing AMIs and scaling strategies. Check out t4g.medium instances, they are cheaper and can handle multiple low-traffic WordPress containers. If you're looking at EKS, just be prepared for the steeper learning curve, but it could pay off in the long run if you have the resources!
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions