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.

A tag is a key-value pair where the key and value are case-sensitive. You can use tags to categorize and track all your ElastiCache resources, with the exception of global replication group. When you add or remove tags on replication groups, those actions will be replicated to all nodes in the replication group. For more information, see Resource-level permissions.

For example, you can use cost-allocation tags to your ElastiCache resources, Amazon 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.

Note:

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

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

Syntax

C#
public virtual AddTagsToResourceResponse AddTagsToResource(
         AddTagsToResourceRequest request
)

Parameters

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.

Exceptions

ExceptionCondition
CacheClusterNotFoundException The requested cluster ID does not refer to an existing cluster.
CacheParameterGroupNotFoundException The requested cache parameter group name does not refer to an existing cache parameter group.
CacheSecurityGroupNotFoundException The requested cache security group name does not refer to an existing cache security group.
CacheSubnetGroupNotFoundException The requested cache subnet group name does not refer to an existing cache subnet group.
InvalidARNException The requested Amazon Resource Name (ARN) does not refer to an existing resource.
InvalidReplicationGroupStateException The requested replication group is not in the available state.
InvalidServerlessCacheSnapshotStateException The state of the serverless cache snapshot was not received. Available for Redis only.
InvalidServerlessCacheStateException The account for these credentials is not currently active.
ReplicationGroupNotFoundException The specified replication group does not exist.
ReservedCacheNodeNotFoundException The requested reserved cache node was not found.
ServerlessCacheNotFoundException The serverless cache was not found or does not exist.
ServerlessCacheSnapshotNotFoundException This serverless cache snapshot could not be found or does not exist. Available for Redis only.
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.
UserGroupNotFoundException The user group was not found or does not exist
UserNotFoundException The user does not exist or could not be found.

Examples

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

AddTagsToResource


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

List<Tag> tagList = response.TagList;

            

Version Information

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

See Also