EKS / Client / list_clusters

list_clusters#

EKS.Client.list_clusters(**kwargs)#

Lists the Amazon EKS clusters in your Amazon Web Services account in the specified Amazon Web Services Region.

See also: AWS API Documentation

Request Syntax

response = client.list_clusters(
    maxResults=123,
    nextToken='string',
    include=[
        'string',
    ]
)
Parameters:
  • maxResults (integer) – The maximum number of results, returned in paginated output. You receive maxResults in a single page, along with a nextToken response element. You can see the remaining results of the initial request by sending another request with the returned nextToken value. This value can be between 1 and 100. If you don’t use this parameter, 100 results and a nextToken value, if applicable, are returned.

  • nextToken (string) –

    The nextToken value returned from a previous paginated request, where maxResults was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value. This value is null when there are no more results to return.

    Note

    This token should be treated as an opaque identifier that is used only to retrieve the next items in a list and not for other programmatic purposes.

  • include (list) –

    Indicates whether external clusters are included in the returned list. Use ‘ all’ to return https://docs.aws.amazon.com/eks/latest/userguide/eks-connector.html <https://docs.aws.amazon.com/eks/latest/userguide/eks-connector.html>`__connected clusters, or blank to return only Amazon EKS clusters. ‘ ``all`’ must be in lowercase otherwise an error occurs.

    • (string) –

Return type:

dict

Returns:

Response Syntax

{
    'clusters': [
        'string',
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) –

    • clusters (list) –

      A list of all of the clusters for your account in the specified Amazon Web Services Region.

      • (string) –

    • nextToken (string) –

      The nextToken value returned from a previous paginated request, where maxResults was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value. This value is null when there are no more results to return.

      Note

      This token should be treated as an opaque identifier that is used only to retrieve the next items in a list and not for other programmatic purposes.

Exceptions

  • EKS.Client.exceptions.InvalidParameterException

  • EKS.Client.exceptions.ClientException

  • EKS.Client.exceptions.ServerException

  • EKS.Client.exceptions.ServiceUnavailableException

Examples

This example command lists all of your available clusters in your default region.

response = client.list_clusters(
)

print(response)

Expected Output:

{
    'clusters': [
        'devel',
        'prod',
    ],
    'ResponseMetadata': {
        '...': '...',
    },
}