Skip to content

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

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.

1 Answer
2

Sounds like your EC2 instances can’t register. Your EC2 instances will need access to the ECS endpoint. Either use a VPC end point or ensure they can connect to the internet.

Also you need to ensure your EC2s also have the correct iam role and policies attached.

Could you share this information about your network setup and iam role?

EXPERT
answered 2 years ago
  • Thank you for replying. For my VPC I have one IPv4 CIDR. Two subnets (a private and a public one). Route table with a destination /0 and targeted on my Internet gateway. As for the IAM role I did create a role with the following permissions:

    • AmazonEC2ContainerServiceforEC2Role
    • AmazonS3ReadOnlyAccess

    But I am not quite sure where to attach it when I'm creating my ECS cluster. Sorry if I left anything out. Other then that I normally create a cluster and then a task definition.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.