Deploying Docker Containers in Amazon ECS using Fargate


Deploying Docker Containers in Amazon ECS using Fargate
Posted : October 11th, 2018


AWS Fargate lets you run containers without managing servers or clusters. This article is a guide to deploying a simple “Hello World!” Docker Container in Amazon ECS using Fargate. The container we’ll use is available here, built using this Dockerfile. We’ll create the following ECS Objects:

  • Container Definition specifies the Docker Image to use for the container, along with its port mappings, environment, network settings, resource limits, etc.
  • Task Definition is a blueprint for your application, & specifies which containers are included in your task, how they interact with each other & what resources they use. You can also specify data volumes for your containers to use.
  • Service lets you run & maintain a specified number (the “desired count”) of simultaneous instances of a task definition in a cluster.
  • Cluster is a regional grouping of one or more container instances on which you can run task requests.

We start at the ECS Console at https://console.aws.amazon.com/ecs. Click Create Cluster:

Select the Fargate template & click Next:

Enter Cluster Name, select Create VPC & click Create:

View Cluster:

Select Task Definitions on the left:

Create New Task Definition:

Select Fargate & click Next:

Add Container, enter container Name & Image & click Add:

Enter Task Definition Name & Task Size & click Create:

View Task Definition:

Select Create Service from Actions drop-down:

Select Fargate, enter Service Name & Number of Tasks & click Next:

Select VPC & Subnet & click Next:

Click Next:

Create Service:

View Service:

Click Task ID to view its details:

Note the Public IP:

Allow incoming connections to port 5000 in the security group & open IP:5000 to see the result:

 

(Part 3/6 in AWS series)

Ready to transform and unlock your full IT potential? Connect with us today to learn more about our comprehensive digital solutions.

 

Schedule a Consultation

schedule-consultation

Resources



02 AUG 2021
AWS Named as a Leader for the 11th Consecutive Year…
Know More
27 JUL 2021
Introducing Amazon Route 53 Application Recovery Controller
Know More
09 JUN 2021
Amazon SageMaker Named as the Outright Leader in Enterprise MLOps…
Know More