View a markdown version of this page

Manage tags on AWS Context resources - AWS Context

Manage tags on AWS Context resources

You can add tags to AWS Context resources when you create them. You can also add, list, and remove tags on existing resources.

Resources you can tag

The following table lists the AWS Context resource types that you can tag and their Amazon Resource Name (ARN) formats.

Resource type ARN format

Agent Context

arn:${Partition}:context:${Region}:${Account}:agent-context/${AgentContextId}

Connection

arn:${Partition}:context:${Region}:${Account}:connection/${ConnectionId}

Curation policy

arn:${Partition}:context:${Region}:${Account}:curation-policy/${CurationPolicyId}

Ontology

arn:${Partition}:context:${Region}:${Account}:ontology/${OntologyId}

Ontology induction

arn:${Partition}:context:${Region}:${Account}:ontology-induction/${OntologyInductionId}

You can’t tag built-in ontologies or the tasks and evaluations of an Agent Context. Access to tasks and evaluations is controlled by the tags on their Agent Context. For more information about access to tasks and evaluations, see Access to tasks, evaluations, and Agent Context data.

Tag resources when you create them

The following operations accept an optional tags map, which AWS Context applies to the new resource:

An ontology induction proposes a draft ontology, so StartOntologyInduction accepts one tag map for the induction and one for that ontology:

tags

Tags for the ontology induction.

ontologyTags

Tags for the ontology that the induction creates. AWS Context applies these tags when the induction creates the ontology. An induction that fails or is canceled creates no ontology.

In the AWS Command Line Interface (AWS CLI), use the --tags option to add tags when you create a resource. For start-ontology-induction, use --tags for the induction and --ontology-tags for the ontology.

Add, list, and remove tags

To manage the tags on an existing resource, use the following API operations:

  • TagResource adds tags to a resource. If a key already exists on the resource, TagResource replaces the value of that key.

  • UntagResource removes tags from a resource by key.

  • ListTagsForResource lists the tags on a resource.

The following examples use the AWS CLI to manage tags on an Agent Context. In these examples, replace us-east-1, 111122223333, and ac-EXAMPLE11111 with your Region, account ID, and Agent Context ID.

To add tags to a resource, run the tag-resource command:

aws context tag-resource \ --resource-arn arn:aws:context:us-east-1:111122223333:agent-context/ac-EXAMPLE11111 \ --tags department=billing,project=alpha

To remove tags from a resource, run the untag-resource command with the keys to remove:

aws context untag-resource \ --resource-arn arn:aws:context:us-east-1:111122223333:agent-context/ac-EXAMPLE11111 \ --tag-keys project

To list the tags on a resource, run the list-tags-for-resource command:

aws context list-tags-for-resource \ --resource-arn arn:aws:context:us-east-1:111122223333:agent-context/ac-EXAMPLE11111

The list-tags-for-resource command returns output similar to the following:

{ "tags": { "department": "billing" } }

AWS Context logs TagResource, UntagResource, and ListTagsForResource calls in AWS CloudTrail and records the tags in create requests. For more information, see Logging AWS Context API calls using AWS CloudTrail.

Tag restrictions

The following restrictions apply to tags on AWS Context resources:

  • Each resource can have up to 50 user tags. User tags are tags whose keys don’t start with aws:.

  • A tag key must be 1–128 characters long.

  • A tag value must be 0–256 characters long.

  • Tag keys are case-sensitive. For example, Team and team are different keys.

  • AWS reserves keys that start with aws:. You can’t add or remove these tags.

  • Tags must comply with any AWS Organizations tag policies that apply to your account. For more information, see Tag policies in the AWS Organizations User Guide.