Code Deploy

Introduction

  • A deployment service that automates application deployments to

    • EC2 instances

    • on-premises instances

    • Lambda

    • ECS

  • Does not launch AWS resources automatically like CloudFormation, Opsworks, and Elastic Beanstalk.

Feature

  • Deploy to EC2

    • Define how to deploy the application using appspec.yml + strategy

    • Will do in-place update (take off partial v1, provision v2, replace all in the end) to your fleet of EC2 instances

    • Can use hooks to verify the deployment after each deployment phase

  • CodeDeploy to ASG

    • In-place updates

      • Updates current existing EC2 instances

      • Instances newly created by an ASG will also get automated deployments

    • Blue / Green Deployment

      • A new auto-scaling group is created (settings are copied)

      • Choose how long to keep the old instances

      • Must be using an ELB

  • CodeDeploy to Lambda

    • Supports Blue / Green Deployments

      • Canary

      • Linear

      • All-at-once

    • Traffic Shifting with Lambda Alias

    • Pre / Post Traffic Hooks

      • Pre Traffic Hook: validate the v2

      • Post Traffic Hook: rollback to v1 / clean up

    • Easy & automated rollback using CloudWatch Alarms

    • SAM framework natively uses CodeDeploy

  • CodeDeploy to ECS

    • Supports Blue / Green Deployments for ECS / ECS Fargate

      • Canary

      • Linear

      • All-at-once

    • Setup is done within the ECS Service definition

    • A new task set is created, and traffic is re-routed to the new task test.

    • Then if everything is stable for X minutes, the old task set is terminated.

Last updated