My tasks are in PENDING status
That's what I can see in the events
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?
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:
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'