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:
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 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/3 in AWS series)
“Harish KM is a consultant at Systems Plus. The content of this blog is personal & for information purposes only, and is subject to change. Reader discretion is advised”