DEV Community

Cover image for πŸš€ Zero-Downtime In-Place Deployments with AWS CodeDeploy, Auto Scaling, and Rollback
Latchu@DevOps
Latchu@DevOps

Posted on • Edited on

πŸš€ Zero-Downtime In-Place Deployments with AWS CodeDeploy, Auto Scaling, and Rollback

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)