Tag a CloudFront resource
Tags are words or phrases that you can use to identify and organize your Amazon resources.
You can add multiple tags to each resource, and each tag includes a key and a value that you
define. For example, the key might be "domain" and the value might be "example.com". You can
search and filter your resources based on the tags you add.
For more information about use cases for tags, see Common tagging strategies
You can use tags with CloudFront, such as the following examples:
-
Enforce tag-based permissions on CloudFront distributions. For more information, see ABAC with CloudFront.
-
Track billing information in different categories. When you apply tags to CloudFront distributions or other Amazon resources (such as Amazon EC2 instances or Amazon S3 buckets) and activate the tags, Amazon generates a cost allocation report as a comma-separated value (CSV file) with your usage and costs aggregated by your active 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 about using tags for cost allocation, see Using cost allocation tags in the Amazon Billing User Guide.
Notes
-
You can tag distributions, but you can't tag origin access identities or invalidations.
-
Tag Editor and Resource groups aren't currently supported for CloudFront.
-
For the current maximum number of tags that you can add to a distribution, see General quotas.
Contents
Tag restrictions
The following basic restrictions apply to tags:
-
For the maximum number of tags per distribution, see General quotas.
-
Maximum key length – 128 Unicode characters
-
Maximum value length – 256 Unicode characters
-
Valid values for key and value – a-z, A-Z, 0-9, space, and the following characters: _ . : / = + - and @
-
Tag keys and values are case sensitive
-
Don't use
aws:as a prefix for keys. This prefix is reserved for Amazon use.
Tag your resources for billing
You can use tags to organize your Amazon bill to reflect your own cost structure. To do this, you must first activate tags for cost allocation in the Billing and Cost Management console. For more information about setting up a cost allocation report with tags, see Monthly cost allocation report in the Amazon Billing User Guide. To see the cost of your combined resources, you can organize your billing information based on resources that have 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 Amazon Billing User Guide.
Note
If you've just enabled reporting, data for the current month is available for viewing after 24 hours.
Add, edit, and delete tags
You can use the CloudFront console to manage tags for your CloudFront resources.
To add tags, edit, or delete tags for a resource
Sign in to the Amazon Web Services Management Console and open the CloudFront console at https://console.amazonaws.cn/cloudfront/v4/home
. -
Navigate to your resource:
-
For a distribution: Choose the ID for the distribution that you want to update.
-
For a function: Choose Functions, then choose the name of the function that you want to update.
-
For a KeyValueStore: Choose Functions, choose the KeyValueStore tab, then choose the name of the KeyValueStore that you want to update.
-
-
Choose the Tags tab.
-
Choose Manage tags.
-
On the Manage tags page, you can do the following:
-
To add a tag, enter a key and, optionally, a value for the tag. Choose Add new tag to add more tags.
-
To edit a tag, change the tag’s key or its value, or both. You can delete the value for a tag, but the key is required.
-
To delete a tag, choose Remove.
-
-
Choose Save changes.
Programmatic tagging
You can also use the CloudFront API, Amazon Command Line Interface (Amazon CLI), Amazon SDKs, and Amazon Tools for Windows PowerShell to apply tags. For more information, see the following topics:
-
CloudFront API operations:
-
Amazon CLI – See cloudfront
in the Amazon CLI Command Reference -
Amazon SDKs – See the applicable SDK documentation on the Amazon Documentation page
-
Tools for Windows PowerShell – See Amazon CloudFront in the Amazon Tools for PowerShell Cmdlet Reference