Using Amazon ECS for Blue-Green Deployments


248 students completed the lab in ~1h:9m

Total available time: 1h:55m

72 students rated this lab!

Using Amazon CodeBuild and EC2 Container Service to Perform a Blue-Green Deployment

Lab Overview

Amazon EC2 Container Registry (ECR) is a fully-managed Docker container registry that helps you store, manage, and deploy Docker container images.  ECR is integrated with Amazon EC2 Container Service (ECS), streamlining your development and deployment operations. You can use Amazon's other services such as Simple Storage Service (S3) and Identity and Access Management (IAM) to control and manage your entire container-based solution. In this Lab you will build two Docker container images with Amazon CodeBuild, push the images to ECR, and perform a blue-green deployment operation using ECS.

Lab Objectives

Upon completion of this Lab you will be able to:

  • Use application source files to create Docker container images and place them in Amazon ECR.
  • Create an Amazon ECS cluster.
  • Use the Amazon ECR images to create task definitions and services.
  • Implement the services in ECS container instances and adjust instance numbers.
  • Register ECS container instances with an Application Load Balancer (ALB).
  • Switch from one deployed application to another quickly and with no downtime.

Lab Prerequisites

You should be familiar with:

  • Basic understanding of local operating system and computer use.
  • An understanding of Docker and container concepts is helpful, but not required.

Lab Environment

Before completing the Lab instructions the environment will look as follows:

After completing the Lab instructions the environment should look similar to:

Have a look at what you will learn

Follow these steps to learn by building helpful cloud resources

Logging in to the Amazon Web Services Console

Your first step to start the Lab experience

Creating the EC2 Container Repository

Create a place to store and reference your Docker images

Building the Docker Images

Use CodeBuild to create and push Docker images

Creating the ECS Cluster

Prepare the compute resources needed for your application

Creating the Task Definitions

Specify Docker images and resource requirements

Creating the Target Group and Load Balancer

Set up a gateway to your containers and applications

Creating the ECS Services

Define how to run your applications

Viewing Instances and Application Message

See your deployed resources and application in action

Updating the Services and Application Deployments

Transition between the blue and green applications with no downtime

Deleting the ECS Laboratory Resources

Delete the applications and deployment resources