In this 3rd and last part of 3-part series on ECR Repository, I am going to show you how to create a Fargate Cluster and a Service which uses the task definition that points to the image in the repository - nginx and access Docker image with Nginx from - Application Load Balancer and Fargate Cluster.
Fargate removes the need to provision and manage servers, lets you specify and pay for resources per application, and improves security through application isolation by design.
1st article
- As a reference, please read my 1st article - How to create a Docker Image with Nginx from an EC2 Instance and Push to ECR Repository
2nd article
- As a reference, please read my 2nd article -Create Task Definition in ECS and Application Load balancer (ALB) for the Task which is to be run on Fargate Cluster
Let’s get started!
Please visit my GitHub Repository for Docker/ECS/ECR articles on various topics being updated on constant basis.
Objectives:
1. Create Fargate cluster - my-ecs-cluster
2. Create a Service - my-service
3. Validate by accessing Docker image with Nginx from - Application Load Balancer and Fargate Cluster.
4. Cleanup
Pre-requisites:
- AWS user account with admin access, not a root account.
- AWS CLI.
Resources Used:
Amazon Elastic Container Service
Steps for implementation to this project:
1. Create Fargate cluster - my-ecs-cluster
On the Amazon Elastic Container Service (ECS) Dashboard, Click Clusters, Create cluster, my-ecs-cluster, default vpc, 2 public subnets - us-east-1a, us-east-1b, Infrastructure - Your cluster is automatically configured for AWS Fargate (serverless)
Create
2. Create a Service - my-service
Click my-ecs-cluster
Take the below values for creating a Service - my-service
PHOTO-1
- PHOTO-2
- PHOTO-3
- PHOTO-4
- PHOTO-5
- PHOTO-6
- Create
my-service
3. Validate by accessing Docker image with Nginx from - Application Load Balancer and Fargate Cluster.
Click cluster - ecs-cluster, click tab - Tasks, Click the task, Copy the Public IP
paste the Public IP on a web browser
-
Click my-ecs-alb, copy DNS name of ALB
paste DNS name of ALB on a Web browser
4. Cleanup
on the service - my-service, Desired-task - 0, Update
then delete service, task, cluster, Load balancer, Target groups, EC2 instance, and service group
What we have done so far
- We have successfully created a Fargate Cluster and a Service which uses the task definition that points to the image in the repository - nginx and accessed Docker image with Nginx from - Application Load Balancer and Fargate Cluster.
Top comments (3)
I already did it twice. Thanks for the post!
Thanks for sharing.
Anyway, you can try to use a series to link all related posts.
thanks, that means creating another new post and link 3 post together