:doc:`ECS <../../ecs>` / Client / list_clusters

*************
list_clusters
*************



.. py:method:: ECS.Client.list_clusters(**kwargs)

  

  Returns a list of existing clusters.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListClusters>`_  


  **Request Syntax**
  ::

    response = client.list_clusters(
        nextToken='string',
        maxResults=123
    )
    
  :type nextToken: string
  :param nextToken: 

    The ``nextToken`` value returned from a ``ListClusters`` request indicating that more results are available to fulfill the request and further calls are needed. If ``maxResults`` was provided, it's possible the number of results to be fewer than ``maxResults``.

     

    .. 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.

      

    

  
  :type maxResults: integer
  :param maxResults: 

    The maximum number of cluster results that ``ListClusters`` returned in paginated output. When this parameter is used, ``ListClusters`` only returns ``maxResults`` results in a single page along with a ``nextToken`` response element. The remaining results of the initial request can be seen by sending another ``ListClusters`` request with the returned ``nextToken`` value. This value can be between 1 and 100. If this parameter isn't used, then ``ListClusters`` returns up to 100 results and a ``nextToken`` value if applicable.

    

  
  
  :rtype: 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 ``nextToken`` value to include in a future ``ListClusters`` request. When the results of a ``ListClusters`` request exceed ``maxResults``, this value can be used to retrieve the next page of results. This value is ``null`` when there are no more results to return.

        
  
  **Exceptions**
  
  *   :py:class:`ECS.Client.exceptions.ServerException`

  
  *   :py:class:`ECS.Client.exceptions.ClientException`

  
  *   :py:class:`ECS.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': {
            '...': '...',
        },
    }

  