Adding tags to views
You can add tags to your views to categorize them. Tags are customer-supplied metadata that take the form of a key name string and an associated optional value string. For general information about tagging AWS resources, see Tagging AWS Resources in the Amazon Web Services General Reference.
Add tags to your views
You can add tags to your Resource Explorer views by using the AWS Management Console or by running AWS CLI commands or their equivalent API operations in an AWS SDK.
Controlling permissions with tags
One key use of tagging is to support an attribute-based access control (ABAC) strategy. ABAC can help simplify permission management by letting you tag resources. Then, you grant permission to users for resources that are tagged a certain way.
For example, consider this scenario. For a view called ViewA
, you attach
the tag environment=prod
(key
name=value). Another ViewB
might be tagged
environment=beta
. You tag your roles and users with the same tags and
values, based on which environment each role or user should be able to access.
Then, you could assign an AWS Identity and Access Management (IAM) permission policy to your IAM roles,
groups, and users. The policy grants permission to access and search using a view only
if the role or user making the search request has an environment
tag with
the same value as the environment
tag attached to the view.
The benefit to this approach is that it's dynamic and doesn't require you to maintain a list of who has access to which resources. Instead, you ensure that all resources (your views) and principals (IAM roles and users) are tagged properly. Then, the permissions update automatically without you having to change any policies.
Referencing tags in an ABAC policy
After your views are tagged, you can choose to use those tags to control access
dynamically to those views. The following example policy assumes that both your IAM
principals and your views are tagged with the tag key environment
and some
value. When that is done, you can attach the following example policy to your
principals. Your roles and users can then Search
using any views that are
tagged with an environment
tag value that exactly matches the
environment
tag attached to the principal.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "resource-explorer-2:GetView", "resource-explorer-2:Search" ], "Resource": "arn:aws:resource-explorer-2:us-east-1:123456789012:view/*", "Condition": { "ForAnyValue:StringEquals": { "aws:ResourceTag/
environment
": "${aws:PrincipalTag/environment
}" } } } ] }
If both the principal and view have the environment
tag but the values
don't match, or if either is missing the environment
tag then Resource Explorer denies
the search request.
For more information about using ABAC to securely grant access to your resources, see What is ABAC for AWS?