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.
Container for the parameters to the TagResource operation.
Associates the specified tags to a resource with the specified resourceArn
.
If existing tags on a resource aren't specified in the request parameters, they aren't
changed. When a resource is deleted, the tags that are associated with that resource
are deleted as well.
Namespace: Amazon.ECS.Model
Assembly: AWSSDK.ECS.dll
Version: 3.x.y.z
public class TagResourceRequest : AmazonECSRequest IAmazonWebServiceRequest
The TagResourceRequest type exposes the following members
Name | Description | |
---|---|---|
![]() |
TagResourceRequest() |
Name | Type | Description | |
---|---|---|---|
![]() |
ResourceArn | System.String |
Gets and sets the property ResourceArn. The Amazon Resource Name (ARN) of the resource to add tags to. Currently, the supported resources are Amazon ECS capacity providers, tasks, services, task definitions, clusters, and container instances. In order to tag a service that has the following ARN format, you need to migrate the service to the long ARN. For more information, see Migrate an Amazon ECS short service ARN to a long ARN in the Amazon Elastic Container Service Developer Guide.
After the migration is complete, the service has the long ARN format, as shown below. Use this ARN to tag the service.
If you try to tag a service with a short ARN, you receive an |
![]() |
Tags | System.Collections.Generic.List<Amazon.ECS.Model.Tag> |
Gets and sets the property Tags. The tags to add to the resource. A tag is an array of key-value pairs. The following basic restrictions apply to tags:
|
This example tags the 'dev' cluster with key 'team' and value 'dev'.
var client = new AmazonECSClient(); var response = client.TagResource(new TagResourceRequest { ResourceArn = "arn:aws:ecs:region:aws_account_id:cluster/dev", Tags = new List<Tag> { new Tag { Key = "team", Value = "dev" } } });
.NET:
Supported in: 8.0 and newer, Core 3.1
.NET Standard:
Supported in: 2.0
.NET Framework:
Supported in: 4.5 and newer, 3.5