

# Tagging your resources
Tagging

A tag is a key-value pair that you can add to an Amazon Comprehend resource as metadata. You can use tags on **Analysis jobs**, **Custom classification** models, **Custom entity recognition** models, and **endpoints**. Tags have two major functions: organizing your resources and providing tag-based access control.

To organize your resources with tags, you could add the tag key 'Department' and tag values ‘Sales’ or ‘Legal'. You can then search and filter for resources that are pertinent to your company's legal department.

To provide tag-based access control, create IAM policies with permissions based on tags. A policy can allow or disallow an operation based on the tags provided in your request (request-tags) or tags associated with the resource you're calling (resource-tags). For more information on using tags with IAM, see [Controlling access using tags](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html) in the *IAM User Guide*.

Considerations for using tags with Amazon Comprehend:
+ You can add up to 50 tags per resource, and tags can be added at the time you create the resource, or retroactively.
+  A tag *key* is a required field but a tag *value* is optional.
+ Tags do not have to be unique between resources, but a given resource cannot have duplicate tag keys.
+ Tag keys and values are case sensitive.
+ A tag key can have a maximum of 127 characters; a tag value can have a maximum of 255 characters.
+ The '`aws:`' prefix is reserved for AWS use; you cannot add, edit, or delete tags whose key begins with `aws:`. These tags don't count against your tags-per-resource limit of 50.

**Note**  
If you plan to use your tagging schema across multiple AWS services and resources, remember that other services may have different requirements for allowed characters.

**Topics**
+ [

# Tagging a new resource
](tagging-newtags.md)
+ [

# Viewing, editing, and deleting tags associated with a resource
](tagging-existingtags.md)

# Tagging a new resource


You can add tags to an **Analysis job**, a **Custom classification** model, a **Custom entity recognition** model, or **endpoints**.

1. Sign in to the AWS Management Console and open the Amazon Comprehend console at [https://console.aws.amazon.com/comprehend/](https://console.aws.amazon.com/comprehend/)

1. Select the resource (Analysis job, Custom classification, or Custom entity recognition) you want to create from the left navigation pane.

1. Click **Create job** (or **Create new model**). This takes you to the main 'create' page for your resource. At the bottom of this page, you'll see a '**Tags -** *optional*' panel.  
![\[Console display of the empty tags panel.\]](http://docs.aws.amazon.com/comprehend/latest/dg/images/add-tags-2.png)

   Enter a tag key and, optionally, a tag value. Choose **Add tag** to add another tag to the resource. Repeat this process until all your tags are added. Note that tag keys must be unique per resource.

1. Select the **Create** or **Create job** button to continue creating your resource.

You can also add tags using the AWS CLI. This example shows how to add tags with the [start-entities-detection-job](https://docs.aws.amazon.com/cli/latest/reference/comprehend/start-entities-detection-job.html) command.

```
aws comprehend start-entities-detection-job \
--language-code "en" \
--input-data-config "{\"S3Uri\": \"s3://test-input/TEST.csv\"}" \
--output-data-config "{\"S3Uri\": \"s3://test-output\"}" \
--data-access-role-arn arn:aws:iam::123456789012:role/test \
--tags "[{\"Key\": \"color\",\"Value\": \"orange\"}]"
```

# Viewing, editing, and deleting tags associated with a resource
Viewing, editing, and deleting tags

You can view tags associated with an **Analysis job**, a **Custom classification** model, or a **Custom entity recognition** model.

1. Sign in to the AWS Management Console and open the Amazon Comprehend console at [https://console.aws.amazon.com/comprehend/](https://console.aws.amazon.com/comprehend/)

1. Select the resource (Analysis job, Custom classification, or Custom entity recognition) that contains the file with the tags you want to view, modify, or delete. This displays the list of existing files for your selected resource.  
![\[Amazon Comprehend analysis jobs page, which displays your analysis jobs.\]](http://docs.aws.amazon.com/comprehend/latest/dg/images/modify-tags-1.png)

1. Click the name of the file (or model) whose tags you want to view, modify, or delete. This takes you to the details page for that file (or model). Scroll down until you see a **Tags** box. Here, you can see all the tags associated with your selected file (or model).  
![\[The Tags panel displays the current tags associated with your selected resource.\]](http://docs.aws.amazon.com/comprehend/latest/dg/images/modify-tags-2.png)

   Select **Manage tags** to edit or remove tags from your resource.

1. Click on the text you want to modify, then edit your tag. You can also remove the tag by selecting **Remove tag**. To add a new tag, select **Add tag**, then enter your desired text in the blank fields.  
![\[The Tags panel displays the current keys and values. You can modify tags, delete tags, or add a tag.\]](http://docs.aws.amazon.com/comprehend/latest/dg/images/modify-tags-3.png)

   When you're finished modifying your tags, select **Save**.