1
votes

I am trying to follow the instructions here to add an instance to my AWS ECS cluster.

So I:

  1. Created an autoscaling launch configuration for autoscaled instances (AMI: ami-a28476c2 us-west-2)
  2. The instance boots from the autoscale group with no issues, but never joins my ECS cluster default as the docs say it should.
  3. I sshed into the instance and cat the logs and see:

    [ec2-user@ip-172-31-47-157 ~]$ cat /var/log/ecs/ecs-init.log.2016-05-10-03 2016-05-10T03:31:21Z [INFO] pre-start 2016-05-10T03:31:22Z [INFO] start 2016-05-10T03:31:22Z [INFO] No existing agent container to remove. 2016-05-10T03:31:22Z [INFO] Starting Amazon EC2 Container Service Agent 2016-05-10T03:31:23Z [ERROR] could not start Agent: API error (500): Cannot start container dbee780d6770f62afc3266ba14b77957a5e6054f94e89b2ced77f9636c4be64b: open /etc/resolv.conf: no such file or directory

So it looks like the ECS agent is failing because it can't find /etc/resolv.conf. I have no idea why this is since I'm following the docs verbatim.

Has anyone tried this in the past? I'm not sure how to go about debugging this.

1

1 Answers

2
votes

I have solved this. Using the help at this page, I found that something (don't know what the cause was) was firewalling the instance.

In my autoscaling launch configuration, I added the following code to user-data section:

#!/bin/bash
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf
echo "nameserver 8.8.4.4" | sudo tee -a /etc/resolv.conf

which creates the missing file (/etc/resolv.conf) and tells the instance to use the Google DNS servers (presumably any DNS servers you want).

And all works great now.