ECS / Client / list_clusters
list_clusters#
- ECS.Client.list_clusters(**kwargs)#
Returns a list of existing clusters.
See also: AWS API Documentation
Request Syntax
response = client.list_clusters( nextToken='string', maxResults=123 )
- Parameters:
nextToken (string) –
The
nextTokenvalue returned from aListClustersrequest indicating that more results are available to fulfill the request and further calls are needed. IfmaxResultswas provided, it’s possible the number of results to be fewer thanmaxResults.Note
This token should be treated as an opaque identifier that is only used to retrieve the next items in a list and not for other programmatic purposes.
maxResults (integer) – The maximum number of cluster results that
ListClustersreturned in paginated output. When this parameter is used,ListClustersonly returnsmaxResultsresults in a single page along with anextTokenresponse element. The remaining results of the initial request can be seen by sending anotherListClustersrequest with the returnednextTokenvalue. This value can be between 1 and 100. If this parameter isn’t used, thenListClustersreturns up to 100 results and anextTokenvalue if applicable.
- Return type:
dict
- Returns:
Response Syntax
{ 'clusterArns': [ 'string', ], 'nextToken': 'string' }
Response Structure
(dict) –
clusterArns (list) –
The list of full Amazon Resource Name (ARN) entries for each cluster that’s associated with your account.
(string) –
nextToken (string) –
The
nextTokenvalue to include in a futureListClustersrequest. When the results of aListClustersrequest exceedmaxResults, this value can be used to retrieve the next page of results. This value isnullwhen there are no more results to return.
Exceptions
ECS.Client.exceptions.ServerExceptionECS.Client.exceptions.ClientExceptionECS.Client.exceptions.InvalidParameterException
Examples
This example lists all of your available clusters in your default region.
response = client.list_clusters( ) print(response)
Expected Output:
{ 'clusterArns': [ 'arn:aws:ecs:us-east-1:<aws_account_id>:cluster/test', 'arn:aws:ecs:us-east-1:<aws_account_id>:cluster/default', ], 'ResponseMetadata': { '...': '...', }, }