Search code examples
amazon-web-servicesamazon-ecsaws-fargate

AWS ECS Fargate: What is the role of ECS Container Instance


I am learning docker and containerization in AWS, so i may be asking a very trivial question. I want some clarification on the ECS Fargate concept. I understand from the documentation, that when i run my ECS cluster with Fargate for managing my containers (TASKS) , all the compute is handled by AWS Fargate. With the same idea in mind, I created a sample application.

  • Uploaded the docker image in ECR
  • Created task definition
  • Launched an ECS Cluster and Started a service referencing the above created Task definition

However, the tasks kept on failing to start. When I linked an EC2 instance to the cluster(also called as ECS Container instance), only then my tasks ran(started).

Can someone please explain me the below -

  1. What role does ECS container instance (EC2) plays in ECS with fargate?
  2. Why is it needed? Can an application run without EC2 instance in this case?
  3. How would you determine the size of EC2 instance to link with ECS Fargate?

Appreciate your time and help. Thank you.


Solution

  • However, the tasks kept on failing to start. When I linked an EC2 instance to the cluster(also called as ECS Container instance), only then my tasks ran(started).

    You've missed a configuration setting somewhere, either on the ECS cluster or the task. Your service is trying to deploy to EC2 instead of Fargate. You do not need an EC2 instance in your cluster when you are using Fargate.