ladderlore
  • Type a service name, like S3 or IAM.

Service · Developer Tools

AWS CodeDeploy

Deploy to EC2, Lambda or ECS with an appspec, lifecycle hooks and automatic rollback.

  • EC2 or on premises

    Modes
    In-place or blue/green
    Configurations
    AllAtOnce, HalfAtATime, OneAtATime
  • AWS Lambda

    Modes
    Blue/green by alias weight
    Configurations
    Canary, linear, all-at-once
  • Amazon ECS

    Modes
    Blue/green by task set
    Configurations
    Canary, linear, all-at-once
Modes and configurations by platform.
  • EC2 or on premises

    Lifecycle hooks
    BeforeInstall, AfterInstall, ApplicationStart, ValidateService
    Used for
    Stop, install, start and check
  • AWS Lambda

    Lifecycle hooks
    BeforeAllowTraffic, AfterAllowTraffic
    Used for
    Test the new version
  • Amazon ECS

    Lifecycle hooks
    AfterAllowTestTraffic, BeforeAllowTraffic, AfterAllowTraffic
    Used for
    Test on test traffic first
Hooks run your checks at set points.

1 / 2

  • EC2 or on premises

    Lifecycle hooks
    BeforeInstall, AfterInstall, ApplicationStart, ValidateService
    Used for
    Stop, install, start and check
  • AWS Lambda

    Lifecycle hooks
    BeforeAllowTraffic, AfterAllowTraffic
    Used for
    Test the new version

2 / 2

  • Amazon ECS

    Lifecycle hooks
    AfterAllowTestTraffic, BeforeAllowTraffic, AfterAllowTraffic
    Used for
    Test on test traffic first
Hooks run your checks at set points.

What it is

AWS CodeDeploy deploys a new revision and controls how traffic moves. An appspec file describes the deployment for the compute platform. On EC2 or on-premises servers it lists files to copy and hook scripts. The method is in-place, which updates the same instances, or blue/green, which launches new ones. Predefined configurations are AllAtOnce, HalfAtATime and OneAtATime, and OneAtATime is the default.

What it is

For Lambda, the appspec names the function, the alias and the old and new versions, and CodeDeploy shifts the alias weight. For Amazon ECS, it shifts a load balancer between the old and new task sets. AWS now also offers built-in ECS blue/green deployments and recommends them for new services. CodeDeploy still works and the exam still tests it. Both platforms offer canary, linear and all-at-once. Examples are LambdaCanary10Percent5Minutes and ECSLinear10PercentEvery1Minutes. ECS blue/green with a Network Load Balancer supports only all-at-once.

What it is

Lifecycle hooks run your validation at set points, such as BeforeAllowTraffic and AfterAllowTraffic for Lambda. A hook returns success or failure to CodeDeploy. Attach CloudWatch alarms, and CodeDeploy rolls back on a failed deployment or an alarm, by redeploying the last good revision or shifting traffic back. For SageMaker AI endpoints use deployment guardrails instead. CodeDeploy fits the Lambda functions and ECS model servers around them.

Remember

  • appspec describes the deployment. Hooks run your checks.
  • EC2: in-place or blue/green. Default OneAtATime.
  • Lambda and ECS: canary, linear or all-at-once traffic shifting.
  • Alarms and failed hooks trigger rollback.
  • ECS blue/green on a Network Load Balancer supports only all-at-once.

Remember

  • SageMaker AI endpoints use deployment guardrails, not CodeDeploy.

On the exam

  • “Shift 10 percent of a Lambda alias for 5 minutes, then the rest” points to LambdaCanary10Percent5Minutes.
  • “Run a smoke test before the new ECS tasks get traffic” points to a BeforeAllowTraffic hook.
  • “Roll back automatically when an alarm fires” points to CodeDeploy alarms with rollback enabled.