hands-on lab

Using Amazon ECS for Blue-Green Deployments

Up to 2h 30m
Get guided in a real environmentPractice with a step-by-step scenario in a real, provisioned environment.
Learn and validateUse validations to check your solutions every step of the way.
See resultsTrack your knowledge and monitor your progress.


Amazon Elastic Container Service (ECS) is a performant and scalable container management and orchestration service available in the public AWS cloud. It supports running your containers in AWS Fargate or using customizable Amazon EC2 instances. Amazon ECS is also able to integrate seamlessly with other AWS services.

Among the many deployment models you can use with Amazon ECS, blue/green deployments, which allow gated deployments with no downtime, are supported.

In this lab, you will use the AWS Management Console to build Docker images and deploy them using Amazon Elastic Container Service (ECS).

Learning Objectives

Upon completion of this lab, you will be able to:

  • Use AWS CodeBuild to create Docker images and place them in Amazon ECR
  • Create an Amazon ECS cluster
  • Create Amazon ECS task definitions and services
  • Switch from one deployed application to another quickly and with no downtime

Intended Audience

  • Candidates for the AWS Developer Associate certification
  • DevOps Engineers
  • Cloud Architects
  • Software Engineers


Familiarity with the following will be beneficial but is not required:

  • Amazon Elastic Container Registry (ECR)
  • AWS CodeBuild
  • Amazon Elastic Compute Cloud (EC2)
  • Amazon Elastic Container Service (ECS)
  • Docker

The following content can be used to fulfill the prerequisites:


March 13th, 2024 - Updated the instructions and screenshots to reflect the latest UI

September 1st, 2023 - Resolved ECS cluster issue

August 15th, 2023 - Resolved task deployment issue

July 10th, 2023 - Resolved intermittent CodeBuild failure

May 22nd, 2023 - Resolved an issue that caused the lab to fail to setup on rare occasions

May 17th, 2023 - Resolved issue with ECSTaskExecution Role

May 3rd, 2023 - Resolved target group issue

April 12th, 2023 - Resolved environment error

March 8th, 2023 - Updated screenshots and instructions to reflect latest UI

February 23rd, 2023 - Addressed an issue with cluster creation instructions

February 17th, 2023 - Updated lab to use aws/codebuild/standard:6.0 image

January 25th, 2023 - Updated the lab for the new Amazon ECS console

January 10th, 2023 - Updated screenshots to reflect the latest UI

May 3rd, 2022 - Updated lab step to improve clarity and user experience

March 18th, 2022 - Updated step 3 to 7 with more/clear screenshots and added instructions

December 27th, 2021 - Updated screenshots and instructions to reflect the latest UI

December 14th, 2021 - Corrected the name of the S3 bucket name referred to in the CodeBuild project 

August, 9th, 2021 - Updated the AWS CodeBuild lab step to reflect the latest user interface changes and clarified some instructions

October 29th, 2020 - Addressed an issue that prevented the ECS services from starting

July 30th, 2020 - Increased time limit based on student feedback

March 5th, 2020 - Added a new lab step that instructs you to remove resources from the lab

May 30th, 2019 - Added a new validation Lab Step to check the work you perform in the Lab in more detail

May 24th, 2019 - Updated CodeBuild instructions and buildspec.yaml to work with the new standard Docker image

January 10th, 2019 - Added a validation Lab Step to check the work you perform in the Lab

July 18th, 2018 - Updated screenshots and instructions to match the new Console experience

Environment before

Environment after

About the author

Eric Raub, opens in a new tab
Labs Researcher and Developer

Eric is a Lab Researcher and Developer working to add to Cloud Academy's library of hands-on labs. He is an IT veteran who enjoys the ever-changing landscape of cloud computing. He also relishes live classical music performances, because sometimes engineering is better heard than seen.

Covered topics

Lab steps

Logging In to the Amazon Web Services Console
Creating an Elastic Container Repository
Building Docker Images with AWS CodeBuild
Creating an Amazon ECS Cluster
Creating Amazon ECS Task Definitions
Creating Amazon ECS Services
Viewing Instances and the Application's Message
Updating the Services and Application Deployments