Skip to main content
Welcome. This lesson explains the deployment strategies AWS CodeDeploy supports for EC2 (and on‑premises), ECS, Lambda, and how EKS (Kubernetes on AWS) is typically handled in CI/CD pipelines. These distinctions are common on certification exams — the materials here were reviewed against the AWS Certified DevOps Engineer - Professional curriculum. When we say “deployment” we mean the moment your software becomes publicly available — the production rollout. Using the food truck analogy: development and staging are kitchen prep; deployment is when you flip the “open” sign and serve real customers. Most strategies are variations on blue–green deployments: an existing environment (blue) is replaced by a new environment (green) while traffic is shifted. Concretely there are three core approaches:
  • Sequential (one-at-a-time): update units one after another.
  • Batched / All-at-once: update a percentage or all units simultaneously.
  • Blue–green (traffic shifting): provision a parallel environment and move traffic (canary or linear shifting).
These approaches apply whether the unit is a VM, a container task, or a Lambda version. Overview: three canonical deployment patterns
  • Sequential (one-at-a-time): lowest blast radius, longest duration.
  • Batched / percentage-based: faster than sequential, allows partial validation.
  • Blue–green / traffic-shifted (canary or linear): safe, controlled cutovers using weighted traffic.
EC2 (and on‑premises) deployment methods
  • Install the CodeDeploy agent on each EC2/on‑prem instance.
  • Supported in-place deployment styles:
    • All‑at‑once — replace all instances simultaneously.
    • Batched / percentage (e.g., 50% then 50%) — update groups of instances.
    • One‑at‑a‑time — sequential replacement with per‑instance verification.
If you run 10 EC2 instances you can update them one-by-one, five-by-five, or all ten depending on configuration and risk tolerance. CodeDeploy also supports blue–green for EC2/on‑prem by provisioning a replacement fleet and shifting traffic via load balancers or router configuration.
A diagram titled "EC2: Half-at-a-Time Deployment Method" showing three stages: all instances running v1 before deployment, then half updated to v2 in step 1, and the remaining instances updated to v2 in step 2.
The batched (half‑at‑a‑time) approach lets you validate a partial rollout before moving to remaining instances — useful for spotting regressions without full exposure.
A diagram titled "EC2: One-at-a-Time Deployment Method" showing blue boxes labeled "v1" being replaced step-by-step by orange boxes labeled "v2." It illustrates a sequential rollout where one instance is updated at a time until all instances are v2.
One‑at‑a‑time is the slowest but safest in‑place option: remove a single instance from service, deploy and validate it, then proceed to the next. ECS deployment methods For Amazon ECS, deployments are most commonly implemented as blue–green traffic shifts (managed via Application Load Balancer and CodeDeploy) or via the service scheduler’s rolling update model (in‑place) controlled by minimumHealthyPercent / maximumPercent. CodeDeploy for ECS supports these traffic‑weighting patterns:
  • Linear — shift traffic incrementally by a fixed percentage over time (for example, 25% every 10 minutes).
  • Canary — shift a small percentage first (for example, 5–20%), validate, then cutover the remainder.
  • All‑at‑once — switch all traffic immediately.
Linear defines a schedule of percentage increments and durations; canary gives you a quick smoke test with minimal exposure.
A diagram titled "ECS: Linear Deployment Method" showing a sequence of deployment steps where blue v1 instances are progressively replaced by orange v2 instances (one step at a time) until all are updated.
Linear strategies are predictable and useful when you want staged validation and gradual user impact.
A diagram of an ECS canary deployment showing two phases: Phase 1 routes 80% of traffic to v1 instances and 20% to v2, and Phase 2 shifts to 0% v1 and 100% v2. It uses a Route 53 icon to indicate traffic routing between the two groups of service instances.
ECS has two common operational modes:
  • Service scheduler rolling update (in‑place): adjust minimumHealthyPercent and maximumPercent to control concurrency.
  • CodeDeploy blue–green: new task set is launched and traffic is shifted using linear/canary strategies.
Lambda deployment methods Lambda uses versions and aliases plus percentage routing to support the same high-level deployment patterns: linear, canary, and all‑at‑once. CodeDeploy integrates these patterns and also provides lifecycle hooks and automatic rollback based on alarms or failures.
  • Linear example: shift 10% every 10 minutes until reaching 100%.
  • Canary example: shift 10% for a short validation, then 100%.
  • All‑at‑once example: route all traffic immediately to the new version.
CodeDeploy can run pre‑traffic and post‑traffic validation hooks, and can rollback automatically when CloudWatch alarms are triggered.
A diagram titled "Lambda: Linear Deployment Method" showing three stages: before deployment (all instances labeled v1), a mid-step with half the instances updated to v2, and a final step where all instances are v2.
Lambda’s traffic‑shifting is platform‑managed — you configure the percentages and verification windows either in CodeDeploy or via Lambda aliases and routing configuration. EKS (Kubernetes on AWS) As of this lesson, CodeDeploy does not provide a native, first‑class deployment driver for Amazon EKS (Kubernetes). For Kubernetes workloads you generally use Kubernetes-native tools and workflows:
  • kubectl for direct manifest application and kubectl rollout commands.
  • Helm charts for templated releases.
  • GitOps (Argo CD, Flux) to drive cluster state from a Git repository.
CI/CD pipelines typically include steps that run kubectl/Helm, or update the Git repo watched by a GitOps controller to manage rollouts and traffic (e.g., via Kubernetes Services, Ingress, or service mesh).
CodeDeploy focuses on EC2/on‑prem, ECS, and Lambda. For EKS use Kubernetes-native tools (kubectl, Helm) or GitOps controllers (Argo CD, Flux) to orchestrate rollouts and traffic management.
If your organization requires centralized CodeDeploy-style workflows for Kubernetes, implement pipeline steps that execute kubectl/Helm or integrate GitOps; do not expect a first‑class CodeDeploy driver for EKS at this time.
Comparison table: quick reference Examples and small command references
  • Launch a simple rolling update in Kubernetes:
    • kubectl set image deployment/nginx nginx=nginx:1.19
  • Adjust ECS service scheduler behavior:
    • set minimumHealthyPercent and maximumPercent in the service definition.
  • Lambda traffic shifting via alias:
    • create a new version and update alias weights using the Console, SDK, or CodeDeploy.
Links and references Summary
  • Three conceptual deployment patterns: sequential, batched (all‑at‑once/percentage), and blue‑green (traffic shifting).
  • EC2 commonly uses in‑place strategies (one‑at‑a‑time, batched, all‑at‑once) and can use blue‑green by provisioning replacement fleets.
  • ECS and Lambda commonly use blue‑green traffic shifting implemented as linear, canary, or all‑at‑once; ECS also supports native rolling updates via the service scheduler.
  • EKS deployments are normally handled with Kubernetes-native tools (kubectl, Helm) or GitOps; CodeDeploy has no native EKS driver.
These are the primary deployment patterns for EC2, ECS, Lambda, and how EKS is typically handled (content current as of fall 2025).

Watch Video