ECS / Client / put_attributes

put_attributes#

ECS.Client.put_attributes(**kwargs)#

Create or update an attribute on an Amazon ECS resource. If the attribute doesn’t exist, it’s created. If the attribute exists, its value is replaced with the specified value. To delete an attribute, use DeleteAttributes. For more information, see Attributes in the Amazon Elastic Container Service Developer Guide.

See also: AWS API Documentation

Request Syntax

response = client.put_attributes(
    cluster='string',
    attributes=[
        {
            'name': 'string',
            'value': 'string',
            'targetType': 'container-instance',
            'targetId': 'string'
        },
    ]
)
Parameters:
  • cluster (string) – The short name or full Amazon Resource Name (ARN) of the cluster that contains the resource to apply attributes. If you do not specify a cluster, the default cluster is assumed.

  • attributes (list) –

    [REQUIRED]

    The attributes to apply to your resource. You can specify up to 10 custom attributes for each resource. You can specify up to 10 attributes in a single call.

    • (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) – [REQUIRED]

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

Return type:

dict

Returns:

Response Syntax

{
    'attributes': [
        {
            'name': 'string',
            'value': 'string',
            'targetType': 'container-instance',
            'targetId': 'string'
        },
    ]
}

Response Structure

  • (dict) –

    • attributes (list) –

      The attributes applied to your resource.

      • (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).

Exceptions

  • ECS.Client.exceptions.ClusterNotFoundException

  • ECS.Client.exceptions.TargetNotFoundException

  • ECS.Client.exceptions.AttributeLimitExceededException

  • ECS.Client.exceptions.InvalidParameterException