Lists the attributes for Amazon ECS resources within a specified target type and cluster. When you specify a target type and cluster, ListAttributes returns a list of attribute objects, one for each attribute on each resource. You can filter the list of results to a single attribute name to only return results that have that name. You can also filter the results by attribute name and value. You can do this, for example, to see which container instances in a cluster are running a Linux AMI ( ecs.os-type=linux ).

See also: AWS API Documentation

Request Syntax

response = client.list_attributes(
  • cluster (string) -- The short name or full Amazon Resource Name (ARN) of the cluster to list attributes. If you do not specify a cluster, the default cluster is assumed.
  • targetType (string) --


    The type of the target to list attributes with.

  • attributeName (string) -- The name of the attribute to filter the results with.
  • attributeValue (string) -- The value of the attribute to filter results with. You must also specify an attribute name to use this parameter.
  • nextToken (string) --

    The nextToken value returned from a ListAttributes 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 .


    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 ListAttributes returned in paginated output. When this parameter is used, ListAttributes 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 ListAttributes request with the returned nextToken value. This value can be between 1 and 100. If this parameter isn't used, then ListAttributes returns up to 100 results and a nextToken value if applicable.
Return type



Response Syntax

    'attributes': [
            'name': 'string',
            'value': 'string',
            'targetType': 'container-instance',
            'targetId': 'string'
    'nextToken': 'string'

Response Structure

  • (dict) --

    • attributes (list) --

      A list of attribute objects that meet the criteria of the request.

      • (dict) --

        An attribute is a name-value pair that's associated with an Amazon ECS object. Use attributes to extend the Amazon ECS data model by adding custom metadata to your resources. For more information, see Attributes in the Amazon Elastic Container Service Developer Guide .

        • name (string) --

          The name of the attribute. The name must contain between 1 and 128 characters. The name may contain letters (uppercase and lowercase), numbers, hyphens (-), underscores (_), forward slashes (/), back slashes (), or periods (.).

        • value (string) --

          The value of the attribute. The value must contain between 1 and 128 characters. It can contain letters (uppercase and lowercase), numbers, hyphens (-), underscores (_), periods (.), at signs (@), forward slashes (/), back slashes (), colons (:), or spaces. The value can't start or end with a space.

        • targetType (string) --

          The type of the target to attach the attribute with. This parameter is required if you use the short form ID for a resource instead of the full ARN.

        • targetId (string) --

          The ID of the target. You can specify the short form ID for a resource or the full Amazon Resource Name (ARN).

    • nextToken (string) --

      The nextToken value to include in a future ListAttributes request. When the results of a ListAttributes 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.


  • ECS.Client.exceptions.ClusterNotFoundException
  • ECS.Client.exceptions.InvalidParameterException