CLOUD CONCEPT

Rolling Deployment

Rolling deployment updates an application in successive batches while keeping part of the existing deployment available to serve traffic.

Cloud Concepts Hub →

What is Rolling Deployment

A rolling deployment gradually updates or replaces running instances, tasks, or pods instead of changing the entire fleet at once. It limits simultaneous disruption and can avoid maintaining a complete second environment, but requires sufficient capacity, reliable health checks, and compatibility between application versions.

A rolling deployment introduces a new application version across a fleet in successive batches. Some instances, tasks, or pods continue serving the previous version while others are updated or replaced. After each batch becomes healthy, the deployment proceeds until the fleet runs the new version. The defining characteristic is gradual change to the serving fleet, not a specific cloud service or deployment tool.

For example, consider a web application running on ten virtual machines behind a load balancer. A deployment process removes two machines from traffic, allows active requests to drain, updates their application, validates readiness, and returns them to service before continuing. The remaining eight machines must handle demand during each batch. Alternatively, the process can launch replacement capacity before removing old machines, increasing temporary cost while preserving serving capacity.

Batch size, minimum healthy capacity, maximum total capacity, startup time, and observation periods determine deployment speed and availability. Small batches reduce the number of resources affected simultaneously but lengthen the rollout. Large batches finish sooner but expose more capacity to a defective release. A successful process checks application readiness and operational signals such as error rates and latency, rather than assuming that a running process is ready to serve users.

For virtual machines, rolling deployment can update application files on existing machines or replace machines using a new image or launch template. AWS CodeDeploy supports batched in-place deployments for EC2 applications. Amazon EC2 Auto Scaling instance refresh progressively replaces instances. These mechanisms solve different problems: deploying application artifacts does not necessarily update the machine image, and changing a launch template alone does not update existing instances.

For containers, an Amazon ECS rolling deployment replaces service tasks according to configured minimum healthy and maximum deployment percentages, subject to available capacity and health checks. Kubernetes Deployments, including those running on Amazon EKS, control replacement pods with maxUnavailable and maxSurge. Readiness probes determine whether pods should receive traffic. A Kubernetes rollout that exceeds its progress deadline is reported as failed; the Deployment controller does not automatically roll it back merely because that deadline expires.

Old and new versions normally coexist during a rollout. APIs, message formats, shared caches, and database schemas must support that overlap. An expand-and-contract database migration can add a new field first, deploy code that supports both schemas, and remove the obsolete field only after old versions are gone. Rolling back application code does not automatically reverse database changes, external side effects, or incompatible messages.

Rolling deployment differs from blue/green deployment, which prepares a separate replacement environment and then switches traffic. It also differs from canary deployment, which deliberately exposes a new version to a limited audience or traffic share for evaluation. A rolling deployment's first batch can provide early feedback, but resource batch size does not guarantee an equivalent percentage of requests. Load balancing, connection reuse, and session affinity affect actual exposure.

Serverless deployments require different terminology. AWS Lambda deployments typically publish versions and shift an alias between them using all-at-once, canary, or linear traffic shifting. Linear traffic shifting is gradual, but it is not replacement of customer-managed hosts in rolling batches. In exam scenarios, distinguish the desired outcome from the platform's supported deployment mechanism.

Rolling deployment does not inherently guarantee zero downtime or automatic rollback. Pipelines must define validation, stop conditions, alarms, and recovery actions supported by the deployment platform. Recovery may require another gradual rollout of the previous version, so retain deployable artifacts and allow enough capacity for both deployment and recovery.

Key aspects of Rolling Deployment

Rolling deployment balances incremental change, healthy capacity, version compatibility, and explicit recovery controls to reduce disruption during releases.

Incremental fleet updates

Update or replace a subset of resources at a time while the rest continue operating. Choose batch sizes according to workload capacity and the acceptable scope of failure.

Availability and capacity controls

Minimum healthy capacity and temporary surge capacity determine how much service remains available during replacement. Account for quotas, scheduler placement constraints, and peak traffic rather than relying only on configured percentages.

Health-gated progression

Validate application readiness before sending traffic to updated resources. Use error rates, latency, and other application-level signals to decide whether the rollout should continue or stop.

Mixed-version compatibility

Old and new application versions commonly serve traffic simultaneously. Maintain compatible APIs, data schemas, and message formats throughout the transition.

Controlled draining and startup

Allow existing requests or jobs to finish before stopping old resources, and allow new resources to initialize before accepting work. Incorrect termination and readiness settings can cause failures even when sufficient capacity exists.

Explicit recovery planning

Retain previous artifacts or resource configurations and define rollback triggers. Automatic rollback is platform-dependent, and reverting application code does not undo every data change or external side effect.

Cloud services for Rolling Deployment

A delivery pipeline should select the rollout mechanism that matches the resource being changed. CodeDeploy can deploy application revisions in batches to EC2 instances, while EC2 Auto Scaling instance refresh replaces instances to adopt new machine configurations. ECS and Kubernetes on EKS manage rolling replacement of tasks and pods; Elastic Beanstalk provides managed batching for application environments.

Across these platforms, load balancing, readiness checks, capacity settings, and monitoring determine whether incremental updates preserve service. CloudWatch alarms can inform supported deployment failure controls. Lambda instead uses version and alias traffic shifting, illustrating why a gradual release is not always a rolling fleet update. Recovery behavior must be configured and tested for the selected platform.

AWS CodeDeploy image AWS CodeDeploy

For EC2 and on-premises applications, CodeDeploy supports in-place deployments with deployment configurations that control deployment concurrency and healthy-host requirements. Lifecycle hooks support application validation; its ECS deployment workflow uses blue/green deployment, while its Lambda workflow shifts traffic between versions.

Open AWS CodeDeploy →
Amazon EC2 Auto Scaling image Amazon EC2 Auto Scaling

Instance refresh progressively replaces Auto Scaling group instances, commonly to adopt a new machine image or launch template version. Healthy-capacity limits, instance warmup, checkpoints, and supported rollback settings help control replacement risk.

Open Amazon EC2 Auto Scaling →
AWS Elastic Beanstalk image AWS Elastic Beanstalk

Elastic Beanstalk supports rolling application deployments that update instances in batches. Its rolling-with-additional-batch policy adds temporary capacity so the application can maintain serving capacity while batches are updated.

Open AWS Elastic Beanstalk →
AWS Lambda image AWS Lambda

Lambda provides a useful platform contrast: deployments can shift alias traffic between published versions rather than replace customer-managed instances. CodeDeploy supports canary, linear, and all-at-once traffic shifting for Lambda; these should not be confused with host-based rolling replacement.

Open AWS Lambda →