How do you set up zero-downtime deployments on AWS?
AWS supports a number of compute runtimes. EC2 instances, ECS tasks, Lambda and others.
The choices are the same for zero-downtime deployments.
- Blue-Green: Have a passive mirror of the live environment, update the mirror, test the deployment, switch the load balancer to the new environment.
- Rolling update: Provision new servers or tasks, and swap them out of the live group one at a time. This is the cheaper option as you do not have to have a full live size environment, but it takes longer.
For ECS/Fargate specifically, this is built in via a configurable minimum/maximum healthy percent during rollout (commonly 100%/200% for blue-green-style safety); for Lambda, it's a weighted alias splitting traffic between the old and new function versions.