If you're managing deployments with AWS CodeDeploy, especially in combination with Auto Scaling Groups (ASGs) and Load Balancers, here's something important you should know โ you can deploy safely, one instance at a time, without downtime, and even rollback on failure.
Let me explain how it works ๐
๐งฑ Deployment Strategy: CodeDeployDefault.OneAtATime
With this strategy, AWS deploys your application to one EC2 instance at a time. If you have 3 instances in your Auto Scaling Group, hereโs how the deployment flows:
๐ Step-by-Step Flow
- CodeDeploy picks 1 instance (out of 3).
- That instance is temporarily removed from the Load Balancer so users donโt see downtime or errors.
- The application is updated in place (old version replaced with new).
- After a successful install + health check, the instance is added back to the Load Balancer.
- The same steps repeat for the next instance, one by one, until all are updated.
๐ฅ What If a Deployment Fails?
- CodeDeploy immediately stops the deployment process.
- Any instance that already received the new version will automatically roll back to the last stable revision.
- Your ASG stays healthy, and only working instances remain in service.
- โ No full outage, no broken app across all nodes.
โ Why This Is Great for Production
- Zero-downtime updates (thanks to Load Balancer integration)
- Safe, gradual rollout
- Automatic rollback on failure
- Scales perfectly with Auto Scaling Groups
๐ง TL;DR
Use CodeDeployDefault.OneAtATime strategy for safe in-place deployments with:
Auto Scaling Groups (ASG)
Elastic Load Balancer (ELB/ALB)
Rollback on failure
It's reliable, simple to set up, and ideal for production environments where uptime matters.
Have you used this strategy? Or do you prefer Blue/Green deployments? Letโs discuss in the comments! ๐
Top comments (0)