Tag your streams in Amazon Kinesis Data Streams - Amazon Kinesis Data Streams

Tag your streams in Amazon Kinesis Data Streams

You can assign your own metadata to streams you create in Amazon Kinesis Data Streams in the form of tags. A tag is a key-value pair that you define for a stream. Using tags is a simple yet powerful way to manage AWS resources and organize data, including billing data.

Review tag basics

You use the Kinesis Data Streams console, AWS CLI, or Kinesis Data Streams API to complete the following tasks:

  • Create a stream with tags

  • Add tags to a stream

  • List the tags for your streams

  • Remove tags from a stream

You can use tags to categorize your streams. For example, you can categorize streams by purpose, owner, or environment. Because you define the key and value for each tag, you can create a custom set of categories to meet your specific needs. For example, you might define a set of tags that helps you track streams by owner and associated application. Here are several examples of tags:

  • Project: Project name

  • Owner: Name

  • Purpose: Load testing

  • Application: Application name

  • Environment: Production

Track costs using tagging

You can use tags to categorize and track your AWS costs. When you apply tags to your AWS resources, including streams, your AWS cost allocation report includes usage and costs aggregated by 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 Use Cost Allocation Tags for Custom Billing Reports in the AWS Billing User Guide.

Understand tag restrictions

The following restrictions apply to tags.

Basic restrictions
  • The maximum number of tags per resource (stream) is 50.

  • Tag keys and values are case-sensitive.

  • You can't change or edit tags for a deleted stream.

Tag key restrictions
  • Each tag key must be unique. If you add a tag with a key that's already in use, your new tag overwrites the existing key-value pair.

  • You can't start a tag key with aws: because this prefix is reserved for use by AWS. AWS creates tags that begin with this prefix on your behalf, but you can't edit or delete them.

  • Tag keys must be between 1 and 128 Unicode characters in length.

  • Tag keys must consist of the following characters: Unicode letters, digits, white space, and the following special characters: _ . / = + - @.

Tag value restrictions
  • Tag values must be between 0 and 255 Unicode characters in length.

  • Tag values can be blank. Otherwise, they must consist of the following characters: Unicode letters, digits, white space, and any of the following special characters: _ . / = + - @.

Tag streams using the Kinesis Data Streams console

You can add, list, and remove tags using the Kinesis Data Streams console.

To view the tags for a stream
  1. Open the Kinesis Data Streams console. In the navigation bar, expand the Region selector and select a Region.

  2. On the Stream List page, select a stream.

  3. On the Stream Details page, choose the Tags tab.

To create a data stream with a tag
  1. Open the Kinesis Data Streams console. In the navigation bar, expand the Region selector and select a Region.

  2. Choose Create a stream.

  3. On the Create data stream page, enter a name for your data stream and then choose either the On-demand or the Provisioned capacity mode. The On-demand mode is selected by default. For more information, see Choose the data stream capacity mode.

  4. In the Tags section, choose Add new tag. Specify the tag in the Key field, and optionally specify a value in the Value field.

    If you see an error, either the tag key or value that you specified don't meet the tag restrictions. For more information, see Understand tag restrictions.

  5. Choose Create data stream.

  6. On the Data streams page, your stream's Status displays as Creating while the stream is being created. When the stream is ready to use, the status changes to Active.

  7. Choose the name of your stream. The Stream Details page displays a summary of your stream configuration, along with monitoring information.

To add a tag to a stream
  1. Open the Kinesis Data Streams console. In the navigation bar, expand the Region selector and select a Region.

  2. On the Stream List page, select a stream.

  3. On the Stream Details page, choose the Tags tab.

  4. Specify the tag key in the Key field, optionally specify a tag value in the Value field, and then choose Add Tag.

    If the Add Tag button is not enabled, either the tag key or tag value that you specified don't meet the tag restrictions. For more information, see Understand tag restrictions.

  5. To view your new tag in the list on the Tags tab, choose the refresh icon.

To remove a tag from a stream
  1. Open the Kinesis Data Streams console. In the navigation bar, expand the Region selector and select a Region.

  2. On the Stream List page, select a stream.

  3. On the Stream Details page, choose the Tags tab, and then choose the Remove icon for the tag.

  4. In the Delete Tag dialog box, choose Yes, Delete.

Tag streams using the AWS CLI

You can add, list, and remove tags using the AWS CLI. For examples, see the following documentation.

create-stream

Creates a stream with tags.

add-tags-to-stream

Adds or updates tags for the specified stream.

list-tags-for-stream

Lists the tags for the specified stream.

remove-tags-from-stream

Removes tags from the specified stream.

Tag streams using the Kinesis Data Streams API

You can add, list, and remove tags using the Kinesis Data Streams API. For examples, see the following documentation:

CreateStream

Creates a stream with tags.

AddTagsToStream

Adds or updates tags for the specified stream.

ListTagsForStream

Lists the tags for the specified stream.

RemoveTagsFromStream

Removes tags from the specified stream.