hands-on lab

Use AWS Fargate for Serverless Deployment of Container Applications

Up to 2h
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.


AWS Fargate is a compute engine for Amazon ECS. It allows you to create and deploy containers with no need to think about the servers or clusters. In the Lab, you will use Amazon Elastic Container Registry (ECR) to create a fully-managed Docker repository for your images. Amazon ECR is integrated with Amazon 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 a Docker container image with Amazon CodeBuild, push the image to ECR, and perform a deployment operation using ECS with Fargate.

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 ECS task definitions and services
  • Implement the services in ECS by using AWS Fargate enjoying the advantages of serverless
  • Register ECS tasks with an Application Load Balancer (ALB) target group

Lab Prerequisites

You should be familiar with:

  • Basic understanding of AWS concepts including VPCs, S3 storage, and Load Balancing
  • An understanding of Docker and container concepts is helpful, but not required.


April 17th, 2024 - Resolved ECS Cluster creation issue

February 28th, 2024 - Updated the instructions and screenshots to reflect the latest UI

September 28th, 2023 - Updated the instructions and screenshots to reflect the latest UI

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

November 22nd, 2022 - Updated the instructions and screenshots to reflect the latest UI

March 14th, 2022 - Updated docker image

October 6th, 2021 - Corrected typing error

September 7th, 2021 - Updated to reflect the latest console experience

July 30th, 2021 - Updated CodeBuild instructions and screenshots, clarified other instructions to reflect latest UI changes

April 16th, 2021 - Moved validation checks to the most relevant lab step for more immediate validation feedback

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

Environment before

Environment after

About the author

Learning paths

Stefano studies Computer Science and is passionate about technology. He loves working with Cloud services and learning all the best practices for them. Google Cloud Platform and Amazon Web Services are the cloud providers he prefers. He is a Google Cloud Certified Associate Cloud Engineer. Node.js is the programming language he always uses to code. When he's not involved in studying or working, Stefano loves riding his motorbike and exploring new places.

Covered topics

Lab steps

Logging In to the Amazon Web Services Console
Creating an Elastic Container Repository
Building the Docker Image
Creating an AWS Fargate Cluster
Creating an Application Load Balancer
Creating a Fargate oriented Task Definition
Deploying the Fargate oriented ECS service
Testing the Deployment and Monitoring it