Cert EspressoLearn. Practise. Find your flow.

A LITTLE FOCUS.
A BIG NEXT STEP.

Your pace. Your space.
AWS · DVA-C03

Deployment strategies and rollback

DVA-C03 · Lesson 20 of 24 · 2:40:55

YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗

Learning with these videos? Subscribe for new courses and exam-style questions.

In this lesson

Prepare for the DVA-C03 exam (AWS Certified Developer – Associate). In this lesson: ECS task definitions and services, EKS deployments, rolling updates and the deployment circuit breaker, blue/green, canary, linear, and all-at-once deployments, CodeDeploy configurations, AppSpec files and hooks, SAM gradual deployments, and automatic and manual rollbacks. Includes three original practice questions.

Study notes

The text of this lesson, to read at your own pace. Information as of November 2026.

All fans at once

At AnyCompany Tickets, a new version of the ticket API reached every fan at once, in the middle of a big sale. Errors rose everywhere, and going back to the old version took an hour of manual work. This lesson covers containers on ECS and EKS, deployment strategies, AWS CodeDeploy, and automatic and manual rollbacks.

Containers on ECS and EKS

On Amazon ECS, a task definition is a JSON blueprint: the image of each container, its CPU and memory, its ports, its environment, its logs, and the IAM roles of the task. Each change registers a new revision, and a service keeps a number of tasks running from one revision. With the Fargate launch type, AWS runs the tasks with no servers to manage, and each task gets its own network interface. On Amazon EKS, a YAML manifest declares a Deployment, with its image and its number of replicas, and kubectl apply sends it to the cluster.

Rolling updates

A rolling update replaces tasks in batches. In ECS, the minimum healthy percent keeps a share of the tasks serving, and the maximum percent allows extra tasks during the deployment, like one hundred and two hundred percent. The deployment circuit breaker stops a rolling update whose new tasks keep failing, and it can roll back to the last working revision. On EKS, a Deployment rolls out the same way, with max surge and max unavailable, and kubectl rollout undo goes back to the previous version.

Deployment strategies

Each strategy trades speed for safety. All at once is the fastest, and every user meets a bad version at the same time. Rolling replaces the old version in batches, so two versions serve side by side for a while. Blue/green runs the new version next to the old one, switches the traffic, and switches back in seconds, at the cost of double resources during the deployment. Canary sends a small share of traffic first, like ten percent for five minutes, then the rest. And linear shifts the traffic in equal steps, like ten percent every minute.

AWS CodeDeploy

AWS CodeDeploy deploys application revisions to EC2 and on-premises servers, to Lambda functions, and to ECS services. An application holds deployment groups, the targets of each environment, each with a deployment configuration, like Lambda canary ten percent five minutes, or ECS linear ten percent every minute. The AppSpec file describes the deployment: for Lambda, the alias and its two versions, and hooks like before allow traffic and after allow traffic, which are Lambda functions that test the new version. On EC2, the CodeDeploy agent runs scripts at hooks like before install, application start, and validate service.

Rollback

Rollbacks can be automatic. CodeDeploy rolls back when a deployment fails, or when a CloudWatch alarm of the deployment group goes off, by deploying the last known good revision again, as a new deployment. A manual rollback is simply a new deployment of an earlier revision. In a SAM template, AutoPublishAlias and DeploymentPreference set all of this up: the canary or linear type, the alarms, and the hooks. And elsewhere, CloudFormation rolls back a failed update, ECS has the circuit breaker and the bake time of blue/green, and a Lambda alias moves back to the previous version.

Recap

Let's recap. ECS task definitions describe containers, Fargate runs them without servers, and EKS manifests declare Deployments. Rolling updates use the minimum healthy and maximum percents, with the circuit breaker. Blue/green switches environments, canary tests a small share first, and linear moves in equal steps. CodeDeploy uses deployment groups, configurations, and AppSpec hooks. And rollbacks redeploy the last good revision, automatically on a failure or an alarm.

Quick checks for this lesson

The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.

  1. An ECS service on Fargate runs four tasks. During each deployment, at least four tasks must keep serving, and up to four new tasks may start next to them. Which settings should the developer choose?

    • Minimum healthy 50% · maximum 100%
    • Minimum healthy 0% · maximum 100%
    • Minimum healthy 100% · maximum 200%
    • Minimum healthy 100% · maximum 100%
    Show the answer

    Minimum healthy 100% · maximum 200%

    One hundred percent keeps all four tasks serving, and two hundred percent lets four new tasks start next to them. “Minimum healthy 50% · maximum 100%” would let the service drop to two tasks. “Minimum healthy 0% · maximum 100%” would let ECS stop every task before starting new ones. And “Minimum healthy 100% · maximum 100%” would leave no room for a new task, so the deployment could not start any.

  2. A new version of a function must get 10% of the traffic for five minutes, then all of it, and a test function must check it before any traffic shifts. What should the developer configure?

    • A canary configuration, with a BeforeAllowTraffic hook
    • A linear configuration, with an AfterAllowTraffic hook
    • An all-at-once configuration, with an alarm
    • A rolling update, with the circuit breaker
    Show the answer

    A canary configuration, with a BeforeAllowTraffic hook

    A canary configuration shifts ten percent for five minutes, then the rest, and the before allow traffic hook runs the test first. “A linear configuration, with an AfterAllowTraffic hook” would shift traffic in many steps, and its hook would run after the traffic had moved. “An all-at-once configuration, with an alarm” would move all the traffic at once. And “A rolling update, with the circuit breaker” would replace ECS tasks, not shift traffic between versions of a function.

  3. During a canary deployment of a function, the error rate rises after two minutes. The team wants the traffic back on the old version, with no one acting. What should the developer configure?

    • A manual approval before the deployment
    • A longer canary step of thirty minutes
    • Drift detection on the stack
    • An alarm, with automatic rollback
    Show the answer

    An alarm, with automatic rollback

    An alarm on the error rate, with automatic rollback in the deployment group, sends the traffic back to the last good version. “A manual approval before the deployment” would add a person before the deployment, not a reaction during it. “A longer canary step of thirty minutes” would only make the canary step longer, with nothing to stop it. And “Drift detection on the stack” would look for manual changes to a stack, not errors.