AWS CodeDeploy Concepts

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

Internal

Overview

I started to look into AWS CodeDeploy for a standard way to trigger a new ECS deployment when a new container image shows up in ECR. Based on what I've read so far, ASW CodeDeploy is not what I need, or at least, it's not the preferred way of doing it. Apparently, AWS CodePipeline is. An ECS service, when configured with blue/green deployments, automatically creates a backing AWS CodeDeploy infrastructure, consisting of CodeDeploy application and CodeDeploy deployment group. The deployments are triggered by actual CodeDeploy deployments, but they are not publicly exposed and cannot be accessed, at least from the console.

Application

Application Types

ECS Application

An ECS application is a collection of deployment groups and revisions. The deployments use the ECS compute platform.

Lambda Application

EC2 Application

Deployment Group

Working with Deployment Groups in CodeDeploy

Deployment Group Types

ECS Deployment Group

An ECS Deployment Group specifies the ECS service with the containerized application to deploy as a task set, a production and optional test listener used to serve traffic to the deployed application, when to reroute traffic and terminate the deployed application's original task set, and optional trigger, alarm, and rollback settings.

Lambda Deployment Group

EC2 Deployment Group

Target Group

In the context of a deployment group, a load balancer target groups routes traffic during your deployment. CodeDeploy binds one target group to the Amazon ECS service's original task set and the other to its replacement task set. For more details, see:

AWS Elastic Load Balancing Concepts - Target Groups

Service Role

Deployment

Deployment Types

ECS Deployment

An ECS deployment is a process that deploys an updated version of an ECS containerized application as a new, replacement task set. CodeDeploy reroutes production traffic from the task set with the original version to the new replacement task set with the updated version. When the deployment completes, the original task set is terminated. A deployment belongs to a deployment group, and links to a revision, essentially AppSpec metadata, which can be specified in-line or as a file stored in S3.

Lambda Deployment

EC2 Deployment

Deployment Configuration

Deployment Configuration Types

ECS Deployment Configuration

Traffic is always shifted all at once. Custom deployment configuration settings cannot be specified for an Amazon ECS deployment. This reality is reflected by the fact that a ECS deployment group always refers to a CodeDeployDefault.ECSAllAtOnce deployment configuration.

Lambda Deployment Configuration

EC2 Deployment Configuration

Revision

Revision Types

ECS Revision

For ECS, a revision is an AppSpec file that specifies the task definition for the ECS service with the containerized application to deploy, the container where the updated application is deployed, a port for the container where production traffic is rerouted and optional network configuration settings and Lambda functions that can run validation tests during deployment lifecycle event hooks.

Lambda Revision

EC2 Revision

AppSpec

AppSpec

CodeDeploy Agent

The CodeDeploy agent is not used in an AWS Lambda or an Amazon ECS deployment.