Control access with tags
You can use tags in the Condition element of an AWS Identity and Access Management (IAM) policy to control access to AWS Context resources. Use the following condition keys.
| Condition key | Use it to |
|---|---|
|
|
Control access based on the tags on a resource. |
|
|
Control which tags a request can add. |
|
|
Control which tag keys a request can include. |
Changes to tags can take several minutes to affect authorization. This delay applies to every AWS Context resource, and to tasks and evaluations through their Agent Context.
For more information about using tags to control access, and for patterns such as requiring tags, see Controlling access to AWS resources using tags in the IAM User Guide and Implementing and enforcing tagging in the Best Practices for Tagging AWS Resources whitepaper.
Permissions to create tagged resources
To add tags when you create a resource, you need permission for the create action and for context:TagResource on the new resource.
StartOntologyInduction also creates an ontology, so it always requires permission for context:CreateOntology. To control the tags in ontologyTags, put your conditions on context:CreateOntology.
Access to tasks, evaluations, and Agent Context data
When a policy uses the aws:ResourceTag condition key on a task or an evaluation, AWS Context uses the tags on its Agent Context. AWS Context also authorizes actions on an Agent Context’s changesets and curation proposals, and retrieval of its data, against the Agent Context’s current tags. To change who can access them, change the Agent Context’s tags.
For the resource and condition keys of each action, see Actions, resources, and condition keys for AWS services in the Service Authorization Reference.
Example policies
The following examples show only the tag-related permissions. A working request also needs any other permissions that its action requires. In these examples, replace us-east-1 and 111122223333 with your Region and account ID.
Example: Allow a team to work with its Agent Contexts
The following policy applies to Agent Contexts that have the tag team with the value analytics. It allows a principal to view, update, and delete those Agent Contexts.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "context:GetAgentContext", "context:UpdateAgentContext", "context:DeleteAgentContext" ], "Resource": "arn:aws:context:us-east-1:111122223333:agent-context/*", "Condition": { "StringEquals": { "aws:ResourceTag/team": "analytics" } } } ] }
Example: Allow a team to create Agent Contexts tagged for the team
The following policy allows a principal to create Agent Contexts only when the request adds the tag team with the value analytics. It also allows the principal to add tags to Agent Contexts that already have that tag, when the request includes that tag.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "context:CreateAgentContext", "context:TagResource" ], "Resource": "arn:aws:context:us-east-1:111122223333:agent-context/*", "Condition": { "StringEquals": { "aws:RequestTag/team": "analytics", "aws:ResourceTag/team": "analytics" } } } ] }