KurioZ7
KurioZ7

Reputation: 6349

ECS Error: "The closest matching container-instance is missing an attribute required by your task"

I have created a ECS Service, which is not able to run any tasks in the EC2 containers. I keep getting this message under the "Events" tab for Service.

service QA-SVC was unable to place a task because no container instance met all of its requirements. The closest matching container-instance f84f8418-2b63-4d02-ac5f-2ee3860d4fac is missing an attribute required by your task.

I have read almost all the question thread in SO, but I am not able to figure out the cause of this error. The error message does not clearly explain the specific attribute that is missing (or mismatching). I do not know what is in EC2 that I need to configure for the tasks to run on it.

Upvotes: 9

Views: 14513

Answers (5)

Josh-LastName
Josh-LastName

Reputation: 19

My case was similar to @Valera - I accidentally put my instance in the wrong VPC (which I was using for testing) than the ECS service. Ooops! Very misleading error IMO from AWS.

Upvotes: 0

George
George

Reputation: 839

I had this same issue, and ran this command: ecs-cli check-attributes --container-instances <INSTANCE_ID> --task-def <TASK_DEF_ARN> --cluster <CLUSTER_NAME> --region us-east-1

This command was recommended in many places, but my output was just:

Container Instance  Missing Attributes
ClusterName None

It turns out that in my task definition JSON, the runtimePlatform.cpuArchitecture was set to ARM64 instead of X86_64. Updating this then fixed the issue.

Upvotes: 3

Valera
Valera

Reputation: 619

In my case Task Definition was requiring a subnet that wasn't use by any of the cluster EC2 instances.

Upvotes: 1

Alpesh
Alpesh

Reputation: 656

The easiest way to find out which attributes are missing is using ecs-cli check-attributes.

Upvotes: 6

Matus Dubrava
Matus Dubrava

Reputation: 14502

This error is thrown because, as it says, your instance is missing an attribute required by your task.

Some task definition parameters require a specific Docker remote API version to be installed on the container instance. Others, such as the logging driver options, require the container instances to register those log drivers with the ECS_AVAILABLE_LOGGING_DRIVERS agent configuration variable. If your task definition contains a parameter that requires a specific container instance attribute, and you do not have any available container instances that can satisfy this requirement, the task cannot be placed. source

How and what attributes you need to configure depends on your task definition requirements. Some require you to update container agent configuration that can be found under /etc/ecs/ecs.config if you have used to ECS optimized AMI.

You will need to go through these links (task definition parameters and container agent configuration) to find out how to exactly configure your instances based on your task definition requirements.

Upvotes: 4

Related Questions