Deploying Docker containers to AWS Elastic Container Service (ECS) is straightforward and automated when you make use of CloudFormation to define your infrastructure in a YAML template. Here we’ll be running through a simple example where we’ll setup everything required to run an NGINX container in AWS and access it over the internet.

AWS ECS Overview

We’ve chosen to run the NGINX official Docker image as it will allow us to browse to port 80 and view the response to prove the container is running. To get this deployed into ECS, we’ll need the following buildings blocks:

  • ECS Task Definition: a specification of your container, including what Docker image to use, what ports to expose, and what hardware resources to allocate
  • ECS Task: a running instance of the ECS Task Definition. Equivalent to a running Docker container.
  • ECS Service: responsible for running instances of your task definition, including how many to deploy, networking, and security
  • ECS Cluster:a grouping of ECS services and tasks
  • ECS Task Execution role: an IAM role which the task will assume, in our case allowing log events to be written to CloudWatch
  • Security Group: a security group can be attached to an ECS Service. We will use it to define rules to allow access into the container on port 80.

#aws #cloud native #ecs #fargate #docker

Automate Docker Container Deployment to AWS ECS Using CloudFormation
1.80 GEEK