4

My tasks are in PENDING status

enter image description here

That's what I can see in the events

enter image description here

There is not many information in the service events.

Here is the task definition in json

{
  "requiresAttributes": [
    {
      "value": null,
      "name": "com.amazonaws.ecs.capability.docker-remote-api.1.17",
      "targetId": null,
      "targetType": null
    },
    {
      "value": null,
      "name": "com.amazonaws.ecs.capability.docker-remote-api.1.18",
      "targetId": null,
      "targetType": null
    },
    {
      "value": null,
      "name": "com.amazonaws.ecs.capability.ecr-auth",
      "targetId": null,
      "targetType": null
    },
    {
      "value": null,
      "name": "com.amazonaws.ecs.capability.task-iam-role",
      "targetId": null,
      "targetType": null
    },
    {
      "value": null,
      "name": "com.amazonaws.ecs.capability.logging-driver.awslogs",
      "targetId": null,
      "targetType": null
    },
    {
      "value": null,
      "name": "com.amazonaws.ecs.capability.task-iam-role-network-host",
      "targetId": null,
      "targetType": null
    },
    {
      "value": null,
      "name": "com.amazonaws.ecs.capability.docker-remote-api.1.19",
      "targetId": null,
      "targetType": null
    }
  ],
  "taskDefinitionArn": "arn:aws:ecs:ap-southeast-2:1234567890:task-definition/SQ1-queuetest:1",
  "networkMode": "host",
  "status": "ACTIVE",
  "revision": 1,
  "taskRoleArn": "arn:aws:iam::1234567890:role/play-ecs",
  "containerDefinitions": [
    {
      "volumesFrom": [],
      "memory": 256,
      "extraHosts": null,
      "dnsServers": null,
      "disableNetworking": null,
      "dnsSearchDomains": null,
      "portMappings": [],
      "hostname": null,
      "essential": true,
      "entryPoint": null,
      "mountPoints": [],
      "name": "sq1",
      "ulimits": null,
      "dockerSecurityOptions": null,
      "environment": [
        {
          "name": "ENV",
          "value": "test"
        }
      ],
      "links": null,
      "workingDirectory": "/app/src/",
      "readonlyRootFilesystem": null,
      "image": "1234567890.dkr.ecr.ap-southeast-2.amazonaws.com/simplequeue:latest",
      "command": [
        "python /app/src/main.py"
      ],
      "user": null,
      "dockerLabels": null,
      "logConfiguration": {
        "logDriver": "awslogs",
        "options": {
          "awslogs-group": "simplequeue",
          "awslogs-region": "ap-southeast-2",
          "awslogs-stream-prefix": "sq1"
        }
      },
      "cpu": 512,
      "privileged": null,
      "memoryReservation": null
    }
  ],
  "placementConstraints": [],
  "volumes": [],
  "family": "SQ1-queuetest"
}

How can I find out more why the task is failing to start?

Anthony Kong
  • 2,976
  • 10
  • 53
  • 91

1 Answers1

0

It seems to be due to the lack of policy AmazonEC2ContainerServiceforEC2Role.

After I assigned this policy to the role, I get a different error message now:

enter image description here

service SQ1-test was unable to place a task because no container instance met all of its requirements. The closest matching container-instance efea641c-6204-4a68-a69f-cb1b07e3529a encountered error "AGENT". For more information, see the Troubleshooting section.

It turns out the above error is caused by an inadvertent removal of the role ecsInstanceRole which was created when a cluster was being created.

Now I can see the status is turned to 'PENDING' enter image description here

Anthony Kong
  • 2,976
  • 10
  • 53
  • 91