navigation

Deploy applications with CI/CD Pipeline on Amazon Elastic Container Service

This exercise requires you to have done the Deploy Application on ECS exercise. Deploying the application test to ECS will serve as a premise to apply the CI/CD Pipeline to start building and deploying the application automatically.

After building and executing the Service in a Cluster, we can make configuration-related changes such as the number of Tasks, add or change Containers, and CPU, Memory, etc values ​​inside the Task. Definition Revision.

To make these changes, ECS provides three methods:

Image Node

Rolling update: executed by ECS, using the service scheduler to update the new version of the Container. During the update process, the number of Tasks added or removed is configured through the following values:

  • Minimum healthy percent: the lower bound of Tasks needs to remain in the RUNNING state / compared to the desired Tasks (declared in Auto Scaling).
  • Maximum percent: The upper bound value of Tasks needs to remain in the RUNNING or PENDING state / compared to the desired Tasks (declared in Auto Scaling).

Blue/Green: implemented by CodeDeploy, maintains two versions: product (BLUE) / test (GREEN). During deployment, the data traffic sent to the service gradually shifts from BLUE to GREEN in one of the following ways:

  • Canary: divides the traffic into 2 parts and determines the time interval to execute the conversion. For example:
    • CodeDeployDefault.ECSCanary10Percent5Minutes: transfers 10% in the first part, and the remaining 90% after 5 minutes.
    • CodeDeployDefault.ECSCanary10Percent15Minutes: transfers 10% in the first part, and the remaining 90% after 15 minutes.
  • Linear: divides the traffic into equal parts and determines the interval. For example:
    • CodeDeployDefault.ECSLinear10PercentEvery1Minutes: 10% change every 1 minute until the end of the whole thing.
    • CodeDeployDefault.ECSLinear10PercentEvery3Minutes: 10% change every 3 minutes until the end of the whole thing.
  • All-at-one: All traffic is converted from BLUE to GREEN at the same time.

External: executed by a third-party deployment controller based on Service/Task APIs.

Main content

  1. Introduction
  2. Preparation steps
  3. Create CodeCommit
  4. Generate CodeBuild
  5. Generate CodePipeline
  6. Troubleshoot
  7. Resource Cleanup