This tutorial will guide you through the process of deploying and running
Docker containers on Amazon Elastic Container Service (
ECS) with AWS
Fargate using AWS
CloudFormation stacks. To accomplish this, we’ll be creating Elastic Container Registry (
ECR) and multiple CloudFormation stacks for groups of resources on the cloud, including VPC, subnets, load balancers, CloudWatch, ECS Cluster, container tasks, and services.
Here are the steps we’ll follow:
- Containerize a simple
REST APIapplication by building a
- Use AWS
CLIto create a repository on Amazon
Elastic Container Registry(Docker Registry).
- Push the Docker image to the repository on Amazon ECR.
- Define and run a
CloudFormationstack to create
VPCand all network components.
- Define and run a CloudFormation stack to create IAM roles.
- Define and run a CloudFormation stack to create ECS Cluster, Load balancer, CloudWatch Log Group, and Security Groups.
- Define and run a CloudFormation stack to deploy the Docker application, including creating a task for the container, a service to schedule the task, a load balancer target group for container services, and a load balancer listener rule for container service.
Upon completing this tutorial, you will be able to create ECS Fargate infrastructure using CloudFormation code, and deploy and execute Docker containers on ECS.