Deploy NestJS App to Amazon ECS
Follow step-by-step instructions to deploy a NestJS app to Amazon ECS.
We'll cover the following
In this lesson, we’ll configure an AWS ALB and learn how to deploy our NestJS app image to Amazon ECS. An ALB is an AWS service that distributes incoming application traffic across multiple targets, such as ECS containers, based on routing rules and health checks.
Prerequisites
Before we start, please ensure that the tasks in the ECR and ECS Configuration lesson have been completed successfully.
Create an ALB
When we create our AWS account, AWS automatically creates a default VPC with three subnets and a security group. Here, we’ll use the default VPC, subnets, and the default security group for the sake of simplicity. In a real-world project, we might like to create a separate VPC and security group depending on the project’s infrastructure.
Creating a target group and an ALB is a common practice when deploying applications to ECS.
A target group in AWS is a logical grouping of targets—such as ECS containers or IP addresses that serve as the destination for requests forwarded by a load balancer—allowing for dynamic scaling and efficient traffic distribution. An ALB distributes incoming traffic across multiple targets, which ensures the workload is evenly distributed, improving the availability and responsiveness of the application.
First, let’s create a target group: address-book-tg
.
Get hands-on with 1400+ tech skills courses.