- Newest
- Most votes
- Most comments
To view all the tags and attributes associated with your current AWS session, you can use the AWS CLI command aws sts get-session-tag or the API equivalent GetSessionTag. This will show you all the session tags that have been applied to your current role session.
For a more comprehensive view of your session context, including both session tags and other session attributes, you can use the AWS CLI command aws sts get-caller-identity combined with aws iam get-user or aws iam get-role depending on your identity type.
When working with IAM database authentication for RDS, you'll need to understand which context keys are available to use in your policies. For tailoring access based on who the user behind the assumed role is, you can use context keys like ${aws:username} in your policy conditions.
For example, in an RDS resource policy, you could use a condition like:
"Condition": {
"StringEqualsIgnoreCase": {"rds:db-tag/Owner": "${aws:username}"}
}
This would allow users to only access RDS resources that they have tagged with their username as the "Owner" value.
When implementing least privilege access, remember that explicit deny statements always take precedence over allow statements in IAM policies. This is important to consider when designing your permission structure across multiple accounts.
If you're having trouble determining which session attributes are available, you might need to examine the SAML assertion that's being passed from your identity provider, as this contains the attributes that get mapped to session tags.
Sources
Amazon RDS: Allows tag owners full access to RDS resources that they have tagged - AWS Identity and Access Management
ClientError: An error occurred (AccessDeniedException) when calling the CreateInferenceComponent operation: | AWS re:Post
Identity-based policy examples for Amazon RDS - Amazon Relational Database Service
answered 10 months ago

As far as I can tell there is no aws sts get-session-tag CLI command and there is no STS API for this so this is an AI hallucination.