AWS Database Blog

Introducing Cost Allocation Tags for Amazon DynamoDB

Nitin Sagar is a senior product manager for DynamoDB.

You can now add tags to your Amazon DynamoDB tables. Tags are simple, user-customizable key and value pairs that are supported by many AWS services. Tagging for DynamoDB provides fine-grained visibility into your DynamoDB bill. You can assign tags to your tables and see cost breakouts per tag.

Let’s consider a real-life scenario in which you have multiple DynamoDB tables for your different development environments—development, staging, and production. You can assign tags to your DynamoDB tables, representing your various environments by adding a tag and setting the tag key to Environment, and the tag value to Development, Staging, or Production.

Let’s look at how to do this using the DynamoDB console. Before you begin, ensure you have the necessary permissions for the following API operations – ListTagsOfResource and TagResource.

  1. Sign in to the AWS Management Console and open the DynamoDB console at https://console.aws.amazon.com/dynamodb/.
  2. Choose Tables, and then choose the table that you want to modify.
  3. In the Settings tab, choose Tags from the navigation menu.
  4. In the Add Tags section, type Environment for Key and Development for Value. Choose Apply Changes.

 

Settings

By default, a newly added tag key is inactive for the billing pipeline. You can activate cost allocation tags in the Billing console by following these steps:

  1. Sign in to the AWS Management Console and open the Billing console at https://console.aws.amazon.com/billing/.
  2. Choose Cost Allocation Tags from the navigation menu.
  3. In the User-Defined Cost Allocation Tags section, select the check box next to the Environment tag key and choose Activate.

 

CostAllocationTags

 

When you have activated your cost allocation tags, the AWS Cost Explorer provides an easy way to see a breakdown of your AWS costs by tagged AWS resources:

  1. Sign in to the AWS Management Console and open the Billing console at https://console.aws.amazon.com/billing/.
  2. Choose Cost Explorer from the navigation menu. Then choose Launch Cost Explorer.
  3. From the menu at top left, choose Monthly costs by service. Select the appropriate time range in the Time range section from the right menu.
  4. In the Filtering section, choose Tag from Filter by.
  5. Choose Environment in the tag key autocomplete field and choose Development in the tag value autocomplete field. Choose Apply.

 

Filtering

 

Your costs are now filtered by the selected tag (Environment=Development). Costs are shown starting from when you applied your tag to your AWS resources (January 15 onward in our example).

 

SaveReport

 

You can add up to 50 tags to your DynamoDB tables by using the DynamoDB Management Console, AWS CLI, or AWS SDK. Global secondary indexes (GSIs) and local secondary indexes (LSIs) associated with base DynamoDB tables are automatically tagged with the same tags that are used for the corresponding DynamoDB base tables. Tagging support for DynamoDB is available in all AWS regions.

You can read more about implementing a consistent and effective tagging strategy for your AWS resources by visiting the AWS Tagging Strategies page.