ECS Bluegreen with Lambda SWAP

Kedarkantha,Uttarakhand,India

Problem Statement !!

The ask was to create a ECS multiAZ service mesh with load balancer and AutoScaling setup. The Service application should have zero downtime when a new update is rolled out to the service mesh.One click disaster recovery should auto trigger in case if the Unittest suit/UAT for the deployment is not passed in a single shot!!

My approach to solve this problem

Since the ask was mainly focused around Zero Downtime , I planned out to use following AWS services to overcome this problem.

  • ECR

  • ECS Cluster

  • Load Balancer (Network)

  • AutoScaling

  • EC2

  • CodeCommit,CodeBuild,CodeDeploy,CodePipeline

  • Lambda

  • CloudFormation

The entire infra provisioning is being monitored by CloudFormation nested stack for changes and according lambda is planned to update stack or rollback stack. As ECS ZeroDowntime was a requirement hence a Lambda SWAP application is also planned to switch load between diffrent AZ's and also to maintain Disaster Recovery a terraform stack is planned which remains Hot for onetime deployment and in the mean time the Lambda Application also heals the reported problems in ECS cluster!! AutoRemediation for certain ECS parameters are taken care of in the Lambda Application since it deals with LoadBalancer and EC2 AZ's.

I have used a sample PHP application from AWS for ECR and ECS. Link to Github Repo

The entire ECS Application is available at my Github

Last updated

Was this helpful?