AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

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.

Note:

For .NET Core this operation is only available in asynchronous form. Please refer to PutAttributesAsync.

Namespace: Amazon.ECS
Assembly: AWSSDK.ECS.dll
Version: 3.x.y.z

Syntax

C#
public virtual PutAttributesResponse PutAttributes(
         PutAttributesRequest request
)

Parameters

request
Type: Amazon.ECS.Model.PutAttributesRequest

Container for the necessary parameters to execute the PutAttributes service method.

Return Value


The response from the PutAttributes service method, as returned by ECS.

Exceptions

ExceptionCondition
AttributeLimitExceededException You can apply up to 10 custom attributes for each resource. You can view the attributes of a resource with ListAttributes. You can remove existing attributes on a resource with DeleteAttributes.
ClusterNotFoundException The specified cluster wasn't found. You can view your available clusters with ListClusters. Amazon ECS clusters are Region specific.
InvalidParameterException The specified parameter isn't valid. Review the available parameters for the API request. For more information about service event errors, see Amazon ECS service event messages.
TargetNotFoundException The specified target wasn't found. You can view your available container instances with ListContainerInstances. Amazon ECS container instances are cluster-specific and Region-specific.

Examples

This example adds an attribute "stack" with the value "production" to a container instance.

To create or update an attribute on a resource


var client = new AmazonECSClient();
var response = client.PutAttributes(new PutAttributesRequest 
{
    Attributes = new List<Attribute> {
        new Attribute {
            Name = "stack",
            Value = "production",
            TargetId = "arn:aws:ecs:us-west-2:123456789012:container-instance/1c3be8ed-df30-47b4-8f1e-6e68ebd01f34"
        }
    },
    Cluster = "MyCluster"
});

List<Attribute> attributes = response.Attributes;

            

Version Information

.NET Framework:
Supported in: 4.5 and newer, 3.5

See Also