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.

Adds up to 50 cost allocation tags to the named resource. A cost allocation tag is a key-value pair where the key and value are case-sensitive. You can use cost allocation tags to categorize and track your AWS costs.

When you apply tags to your ElastiCache resources, AWS generates a cost allocation report as a comma-separated value (CSV) file with your usage and costs aggregated by your tags. You can apply tags that represent business categories (such as cost centers, application names, or owners) to organize your costs across multiple services. For more information, see Using Cost Allocation Tags in Amazon ElastiCache in the ElastiCache User Guide.


For .NET Core and PCL this operation is only available in asynchronous form. Please refer to AddTagsToResourceAsync.

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


public abstract AddTagsToResourceResponse AddTagsToResource(
         AddTagsToResourceRequest request
Type: Amazon.ElastiCache.Model.AddTagsToResourceRequest

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

Return Value
The response from the AddTagsToResource service method, as returned by ElastiCache.


CacheClusterNotFoundException The requested cluster ID does not refer to an existing cluster.
InvalidARNException The requested Amazon Resource Name (ARN) does not refer to an existing resource.
SnapshotNotFoundException The requested snapshot name does not refer to an existing snapshot.
TagQuotaPerResourceExceededException The request cannot be processed because it would cause the resource to have more than the allowed number of tags. The maximum number of tags permitted on a resource is 50.


Adds up to 10 tags, key/value pairs, to a cluster or snapshot resource.


var response = client.AddTagsToResource(new AddTagsToResourceRequest 
    ResourceName = "arn:aws:elasticache:us-east-1:1234567890:cluster:my-mem-cluster",
    Tags = new List {
        new Tag {
            Key = "APIVersion",
            Value = "20150202"
        new Tag {
            Key = "Service",
            Value = "ElastiCache"

List tagList = response.TagList;


Version Information

.NET Framework:
Supported in: 4.5, 4.0, 3.5

Portable Class Library:
Supported in: Windows Store Apps
Supported in: Windows Phone 8.1
Supported in: Xamarin Android
Supported in: Xamarin iOS (Unified)
Supported in: Xamarin.Forms

See Also