DescribeClusters - Amazon Elastic Container Service

DescribeClusters

Describes one or more of your clusters.

For AWS CLI examples, see describe-clusters.rst on GitHub.

Request Syntax

{ "clusters": [ "string" ], "include": [ "string" ] }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

clusters

A list of up to 100 cluster names or full cluster Amazon Resource Name (ARN) entries. If you do not specify a cluster, the default cluster is assumed.

Type: Array of strings

Required: No

include

Determines whether to include additional information about the clusters in the response. If this field is omitted, this information isn't included.

If ATTACHMENTS is specified, the attachments for the container instances or tasks within the cluster are included, for example the capacity providers.

If SETTINGS is specified, the settings for the cluster are included.

If CONFIGURATIONS is specified, the configuration for the cluster is included.

If STATISTICS is specified, the task and service count is included, separated by launch type.

If TAGS is specified, the metadata tags associated with the cluster are included.

Type: Array of strings

Valid Values: ATTACHMENTS | CONFIGURATIONS | SETTINGS | STATISTICS | TAGS

Required: No

Response Syntax

{ "clusters": [ { "activeServicesCount": number, "attachments": [ { "details": [ { "name": "string", "value": "string" } ], "id": "string", "status": "string", "type": "string" } ], "attachmentsStatus": "string", "capacityProviders": [ "string" ], "clusterArn": "string", "clusterName": "string", "configuration": { "executeCommandConfiguration": { "kmsKeyId": "string", "logConfiguration": { "cloudWatchEncryptionEnabled": boolean, "cloudWatchLogGroupName": "string", "s3BucketName": "string", "s3EncryptionEnabled": boolean, "s3KeyPrefix": "string" }, "logging": "string" }, "managedStorageConfiguration": { "fargateEphemeralStorageKmsKeyId": "string", "kmsKeyId": "string" } }, "defaultCapacityProviderStrategy": [ { "base": number, "capacityProvider": "string", "weight": number } ], "pendingTasksCount": number, "registeredContainerInstancesCount": number, "runningTasksCount": number, "serviceConnectDefaults": { "namespace": "string" }, "settings": [ { "name": "string", "value": "string" } ], "statistics": [ { "name": "string", "value": "string" } ], "status": "string", "tags": [ { "key": "string", "value": "string" } ] } ], "failures": [ { "arn": "string", "detail": "string", "reason": "string" } ] }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

clusters

The list of clusters.

Type: Array of Cluster objects

failures

Any failures associated with the call.

Type: Array of Failure objects

Errors

For information about the errors that are common to all actions, see Common Errors.

ClientException

These errors are usually caused by a client action. This client action might be using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Or, it might be specifying an identifier that isn't valid.

The following list includes additional causes for the error:

  • The RunTask could not be processed because you use managed scaling and there is a capacity error because the quota of tasks in the PROVISIONING per cluster has been reached. For information about the service quotas, see Amazon ECS service quotas.

HTTP Status Code: 400

InvalidParameterException

The specified parameter isn't valid. Review the available parameters for the API request.

HTTP Status Code: 400

ServerException

These errors are usually caused by a server issue.

HTTP Status Code: 500

Examples

In the following example or examples, the Authorization header contents (AUTHPARAMS) must be replaced with an AWS Signature Version 4 signature. For more information, see Signature Version 4 Signing Process in the AWS General Reference.

You only need to learn how to sign HTTP requests if you intend to create them manually. When you use the AWS Command Line Interface or one of the AWS SDKs to make requests to AWS, these tools automatically sign the requests for you, with the access key that you specify when you configure the tools. When you use these tools, you don't have to sign requests yourself.

Example

This example request provides descriptive information about the default cluster.

Sample Request

POST / HTTP/1.1 Host: ecs.us-east-1.amazonaws.com Accept-Encoding: identity Content-Length: 25 X-Amz-Target: AmazonEC2ContainerServiceV20141113.DescribeClusters X-Amz-Date: 20150429T185014Z Content-Type: application/x-amz-json-1.1 Authorization: AUTHPARAMS { "clusters": [ "default" ] }

Sample Response

HTTP/1.1 200 OK Server: Server Date: Wed, 29 Apr 2015 18:50:14 GMT Content-Type: application/x-amz-json-1.1 Content-Length: 220 Connection: keep-alive x-amzn-RequestId: 123a4b56-7c89-01d2-3ef4-example5678f { "clusters": [ { "activeServicesCount": 1, "clusterArn": "arn:aws:ecs:us-east-1:012345678910:cluster/default", "clusterName": "default", "pendingTasksCount": 0, "registeredContainerInstancesCount": 0, "runningTasksCount": 0, "status": "ACTIVE" } ], "failures": [] }

Example

This example request provides descriptive information about a cluster that has an associated capacity provider with managed scaling turned on. The capacity provider and the scaling policy that Amazon ECS creates on your behalf are included as attachments in the response.

Sample Request

POST / HTTP/1.1 Host: ecs.us-east-1.amazonaws.com Accept-Encoding: identity Content-Length: 25 X-Amz-Target: AmazonEC2ContainerServiceV20141113.DescribeClusters X-Amz-Date: 20220429T185014Z Content-Type: application/x-amz-json-1.1 Authorization: AUTHPARAMS { "clusters": [ "cluster-with-capacity-provider", "include": ["ATTACHMENTS"] ] }

Sample Response

HTTP/1.1 200 OK Server: Server Date: Wed, 29 Apr 2022 18:50:14 GMT Content-Type: application/x-amz-json-1.1 Content-Length: 220 Connection: keep-alive x-amzn-RequestId: 123a4b56-7c89-01d2-3ef4-example5678f { "clusters": [ { "clusterArn": "arn:aws:ecs:us-west-2:012345678910:cluster/cluster-with-capacity-provider", "clusterName": "cluster-with-capacity-provider", "status": "ACTIVE", "registeredContainerInstancesCount": 0, "runningTasksCount": 0, "pendingTasksCount": 0, "activeServicesCount": 0, "statistics": [], "tags": [], "settings": [], "capacityProviders": [ "FARGATE", "FARGATE_SPOT", "Infra-ECS-Cluster-45ff394c-615f-4496-a336-8019a3b38d7a-EC2CapacityProvider-EXAMPLE" ], "defaultCapacityProviderStrategy": [], "attachments": [ { "id": "bf5ecfe0-f813-4356-b862-1dbe6025c57f", "type": "as_policy", "status": "CREATED", "details": [ { "name": "capacityProviderName", "value": "Infra-ECS-Cluster-45ff394c-615f-4496-a336-8019a3b38d7a-EC2CapacityProvider-EXAMPLE" }, { "name": "scalingPolicyName", "value": "ECSManagedAutoScalingPolicy-55c67464-7691-4310-a725-EXAMPLE" } ] } ], "attachmentsStatus": "UPDATE_COMPLETE" } ], "failures": [] }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: