Tagging Amazon DocumentDB resources
You can use Amazon DocumentDB (with MongoDB compatibility) tags to add metadata to your Amazon DocumentDB resources. These tags can be used with AWS Identity and Access Management (IAM) policies to manage access to Amazon DocumentDB resources and to control what actions can be applied to the resources. You can also use tags to track costs by grouping expenses for similarly tagged resources.
You can tag the following Amazon DocumentDB resources:
-
Clusters
-
Instances
-
Snapshots
-
Cluster snapshots
-
Parameter groups
-
Cluster parameter groups
-
Security groups
-
Subnet groups
Overview of Amazon DocumentDB resource tags
An Amazon DocumentDB tag is a name-value pair that you define and associate with an Amazon DocumentDB resource. The name is referred to as the key.
Supplying a value for the key is optional. You can use tags to assign arbitrary information to an Amazon DocumentDB resource. You can use a tag key, for example,
to define a category, and the tag value might be an item in that category. For example, you might define a tag key of project
and a tag
value of Salix
, indicating that the Amazon DocumentDB resource is assigned to the Salix project. You can also use tags to designate Amazon DocumentDB
resources as being used for test or production by using a key such as environment=test
or environment=production
. We
recommend that you use a consistent set of tag keys to make it easier to track metadata that is associated with Amazon DocumentDB resources.
You can use tags to organize your AWS bill to reflect your own cost structure. To do this, sign up to get your AWS account bill with tag key values included. Then, to see the cost of combined resources, organize your billing information according to resources with the same tag key values. For example, you can tag several resources with a specific application name, and then organize your billing information to see the total cost of that application across several services. For more information, see Using Cost Allocation Tags in the AWS Billing and Cost Management User Guide.
Each Amazon DocumentDB resource has a tag set, which contains all the tags that are assigned to that resource. A tag set can contain as many as 10 tags, or it can be empty. If you add a tag to an Amazon DocumentDB resource that has the same key as an existing tag on resource, the new value overwrites the old value.
AWS does not apply any semantic meaning to your tags; tags are interpreted strictly as character strings. Amazon DocumentDB can set tags on an instance or other Amazon DocumentDB resources, depending on the settings that you use when you create the resource. For example, Amazon DocumentDB might add a tag indicating that an instance is for production or for testing.
You can add a tag to a snapshot, but your bill will not reflect this grouping.
You can use the AWS Management Console or the AWS CLI to add, list, and delete tags on Amazon DocumentDB resources. When using the AWS CLI, you must provide the Amazon Resource Name (ARN) for the resource that you want to work with. For more information about Amazon DocumentDB ARNs, see Understanding Amazon DocumentDB Amazon Resource Names (ARNs).
Tag constraints
The following constraints apply to Amazon DocumentDB tags:
-
Maximum number of tags per resource - 10
-
Maximum Key length - 128 Unicode characters
-
Maximum Value length - 256 Unicode characters
-
Valid characters for Key and Value - uppercase and lowercase letters in the UTF-8 character set, digits, space, and the following characters:
_ . : / = + -
and@
(Java regex:"^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-]*)$"
) -
Tag keys and values are case sensitive.
-
The prefix
aws:
cannot be used for tag keys or values; it is reserved for AWS.
Adding and updating tags on an Amazon DocumentDB resource
You can add up to 10 tags to a resource using the AWS Management Console or the AWS CLI.
Listing tags on an Amazon DocumentDB resource
You can use the AWS Management Console or the AWS CLI to get a listing of the tags for an Amazon DocumentDB resource.
Removing tags from an Amazon DocumentDB resource
You can use the AWS Management Console or the AWS CLI to remove tags from Amazon DocumentDB resources.