Deploying a Scalable Multi-Container Microservice on Amazon ECS

Deploying a Scalable Multi-Container Microservice on Amazon ECS
Deploying a Scalable Multi-Container Microservice on Amazon ECS

CLOUD LABS



Deploying a Scalable Multi-Container Microservice on Amazon ECS

In this Cloud Lab, you’ll learn how to deploy a multi-container microservices app on Amazon ECS. You’ll gain hands-on experience with ECR, DynamoDB, Amazon S3, and Application Load Balancer (ALB).

14 Tasks

intermediate

3hr

Certificate of Completion

Desktop OnlyDevice is not compatible.
No Setup Required
Amazon Web Services

Learning Objectives

Hands on experience with multi-container deployments on ECS
An understanding of service discovery using AWS Cloud Map
The ability to create and deploy multiple services on ECS

Technologies
ECS
ECR logoECR
S3 logoS3
DynamoDB logoDynamoDB
ALB logoALB
Cloud Lab Overview

Amazon Elastic Container Service (ECS) is a fully managed container orchestration service that makes it straightforward to deploy, run, and scale containerized applications on AWS. In this Cloud Lab, you’ll build a small social media application composed of four services, three backend microservices, and one frontend, packaged as Docker images, stored in Amazon ECR, and orchestrated by ECS. You’ll focus on practical deployment patterns, inter-service communication, and load-balanced access for the web frontend.

The application backend is split into three microservices:

  • Users: The users microservice is responsible for session management and user authorization.

  • Posts: The posts service handles the post creation in the application.

  • Feed: The feed service is responsible for aggregating and rendering posts.

The frontend service provides the web UI that calls these backend services. Data is persisted in Amazon DynamoDB tables (one for users and one for posts), while post images are stored in an Amazon S3 bucket. Container images are built on an Amazon EC2 build host, pushed to separate Amazon ECR repositories, and then deployed onto an Amazon ECS cluster. An Application Load Balancer (ALB) exposes the frontend service via a target group.

You’ll start by creating two DynamoDB tables (users and posts), an S3 bucket for image storage, and four ECR repositories, one each for the users, posts, feed, and frontend services. You’ll launch an EC2 instance to build the Docker images and push them to ECR, then stand up an ECS cluster with task definitions and services for all four components. You’ll wire up inter-service communication for the backend, expose the frontend through an ALB, and verify the end-to-end flow by registering a user, creating a post, and viewing the feed. Finally, you’ll explore horizontal scaling by adjusting service desired counts.

You’ll learn how to decompose an application into ECS services with separate task definitions, package and publish images to ECR from a build host on EC2, and combine DynamoDB and S3 for durable, low latency data and object storage. You’ll also learn how to expose a service with an ALB and target groups, establish service-to-service communication, and use basic scaling and operational controls in ECS to make the deployment resilient and ready for growth.

The diagram below summarizes the infrastructure you’ll create in this Cloud Lab:

Microservices deployment on ECS
Microservices deployment on ECS
Cloud Lab Tasks
1.Introduction
Getting Started
Understand the Application Flow
2.Prerequisites
Set Up an S3 Bucket
Set Up DynamoDB Tables
3.Build and Publish Images
Set Up ECR Repositories
Configure EC2 and Push Images to ECR
4.Networking and Service Discovery
Configure Security Groups
Set Up Load Balancing
Configure the Cloud Map
5.Deploy the Services and Host Application
Configure ECS Cluster
Configure ECS Tasks
Configure and Deploy Services
6.Conclusion
Clean Up
Wrap Up
Labs Rules Apply
Stay within resource usage requirements.
Do not engage in cryptocurrency mining.
Do not engage in or encourage activity that is illegal.
Hear what others have to say
Join 1.4 million developers working at companies like