I am trying to create a very simple cluster in sydney region.

enter image description here

It is a very straightforward setup. I specified the harddisk to be 60G. I want to have two ec2 instances in the cluster.

They show up as expected in ec2 panel.

enter image description here

However the ec2 instances are not showing up in the ecs cluster page:

enter image description here

1) Why It happens?

2) Is there any logging I can examine to find out the underlying problem?

  • If you ssh to the instances you created, you should be able to look at the log files in /var/log/ecs to see what problems are reported there. Aug 24, 2017 at 17:07
  • @SamuelKarp The instances have no public IPs Aug 24, 2017 at 22:16

6 Answers 6


You indicated in your comment that the instances have no public IP addresses. I'm extrapolating from that comment that your instances likely have no route to the Internet as well.

In order to use ECS, your instances need to have a route to reach (at a minimum) the ECS service endpoints. A route to the Internet can be through an Internet Gateway (IGW), Network Address Translation (NAT), or through an HTTP Proxy. Without a route to reach the ECS service endpoints, the ECS agent will be unable to register itself into your cluster and you will be unable to use those instances with ECS.


are you using an ecs optimized ami? i would do that and then include this in your user-data when you spawn the instance

echo ECS_CLUSTER=your-cluster-name >> /etc/ecs/ecs.config

if you ssh onto the box, you should be able to see it register with the cluster then in the ecs agent docker logs


[ec2-user@ip-10-0-X-XXX ~]$ docker logs my-ecs-agent-container-id
2019-04-23T20:46:19Z [INFO] Registered container instance with cluster!
2019-04-23T20:46:19Z [INFO] Registration completed successfully. I am running as 'arn:aws:ecs:us-west-2:XXXXXXX:container-instance/xxxxx-yyyy-zzz-ddd-12345gdd' in cluster 'your-cluster'

Fixed the issue by following the following two steps:

1) Make sure 'auto-assign public IPv4 address' is enabled

enter image description here

2) Create and attached a gateway to the VPC. Then add a route to the gateway.

enter image description here

  • 1
    I recently encountered this issue and Step #2 was the solution for me. Thanks for sharing! Jan 28, 2019 at 15:04

The issue for me was that the ECS agent was not starting on the EC2 instance. And was seeing the below error in the ecs agent logs at /var/log/ecs/ecs-init.log

[INFO] Agent exited with code 5
[ERROR] agent exited with terminal exit code

Following the instructions mentioned here and deleting the json file located at var/lib/ecs/data/ecs_agent_data.json and restarting the ECS agent using the below command is what ultimately worked for me.

sudo service docker restart && sudo start ecs

Another possible reason is using non ECS optimized AMI, also, having no outbounds rules in the security group can block the agent.


Choosing the Auto assign public IP -> Enabled worked form me while creating the cluster

Choosing the Auto assign public IP -> Enabled worked for me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.