Ambicatus
Ambicatus

Reputation: 21

ECS cluster starts an EC2 instance, but it still says "Container instances 0"

I am a total beginner with AWS so please go easy on me. I am trying to run an ECS cluster with EC2 instances. So when creating an ECS cluster I can clearly see that an EC2 is created with it on the EC2 instance board, however when going back to my ECS cluster I still see Container instances on 0. This then prevents me on running a Task on EC2 as it states: "You don't have any EC2 instances registered to your cluster. Your tasks won't be able to be run." and when trying to create it anyway I get the error message "No Container Instances were found in your cluster.". Why is that ? Am I missing something here ?

So to recap: ECS reference is seen in the EC2 instance EC2 reference is not seen in the ECS cluster.

Any help or explanation would be really appreciated.

Upvotes: 1

Views: 220

Answers (1)

Mark B
Mark B

Reputation: 200990

The ECS agent software running on the EC2 instance has to be able to connect to the ECS service (via the public ECS API on the Internet) to register the EC2 instance with the ECS cluster. If the EC2 instance doesn't have Internet access, or another way to access the ECS API, then it won't be able to register itself with the ECS cluster.

The EC2 instance needs one of the following to be true:

  • Deployed in a public subnet (a subnet with a route to an Internet Gateway) and a public IP assigned to the EC2 instance
  • Deployed in a private subnet (a subnet that has a route to a NAT Gateway)
  • Deployed to an isolated subnet (a subnet without a route to an Internet Gateway or NAT Gateway) that has an ECS VPC endpoint.

Upvotes: 1

Related Questions