Multi-Region Deployment with the AWS CDK ECS Construct

1 minute read

Published:

Background

Recently at Tarteel, we began to expand some of our services to multiple regions with auto-scaling and load balancing.

We were using Elastic Beanstalk (EB) for our deployments, however, we were noticing issues with scaling on our EC2 instances. Load balancing stickiness wasn’t working out-of-the-box and there were a lot of config files we had to modify and play around with to setup scaling and websocket support properly. Our users were complaining about intermittent connection issues which we believe was caused by the EB load balancing/scaling, but also because we had to user the right EC2 instances for the task.

Moreover, CI/CD with Github Workflows doesn’t play well the the Elastic Beanstalk CLI (I have many questions as to why there’s a seperate CLI and installation process for the EB CLI, but that’s a discussion for another time…)

Since our service was already Dockerized, I decided to give AWS Fargate a shot. It only took me two days and two people to understand what Fargate does and how it works, but after understanding the concepts, I realized what a great tool it is for deploying containers for production!

I’ll go over how we setup our infra for a Docker image using the AWS CDK, which made expanding to new regions and adding different stages really easy.

Guide

Resources

Leave a Comment