alex_halford
alex_halford

Reputation: 439

AWS describe_containers returns empty when queried directly

I am using the boto3 sdk to query the AWS ECS API, to fully describe a Fargate cluster.

I first get the services for the cluster, then the tasks for each service.

A task contains a key containers, which contains a list of containers. These each have an ARN of the form: arn:aws:ecs:eu-west-2:822276179620:container/16328278-00a3-334f-b60c-5e966badd794

I then try to pass these ARNs to boto3's describe_container_instances, passing the correct cluster name, and a list of the containerARNs mentioned above. It errors, claiming that the containerIdentiifers are invalid. Through some experimentation, I discovered that if I split off the part of the ARN after container/ and use that, it no longer errors, but, it claims that all of the containerInstances are 'MISSING' (under the 'failures' key).

Interestingly, if I try to run list_container_instances directly on the cluster, it returns an empty list (200 response, no error).

In summary, the API seems unwilling to let me see container directly. I can only see them as members of the task object (which does not contain all of the information about them that I require).

Upvotes: 2

Views: 835

Answers (1)

Marcin
Marcin

Reputation: 238507

describe_container_instances returns information about container instances:

Describes Amazon Elastic Container Service container instances. Returns metadata about registered and remaining resources on each container instance requested.

However, you are running Fargate cluster, thus you have no access to the instances. They are managed by AWS.

You would be able to access container instances if you were running EC2-type cluster, rather than Fargate:

EC2 Launch Type: The EC2 launch type allows you to run your containerized applications on a cluster of Amazon EC2 instances that you manage.

Upvotes: 3

Related Questions