IAM policy example: read Secrets Manager secrets by tag, with a least privilege rewrite
Facts read 16 Nov 2026. Page reviewed 16 Nov 2026.
Allows a role to read the value of secrets tagged Team with the same value as the caller's Team principal tag. Access follows tags, so new secrets need no policy edit. The original allows reading every secret and listing them all.
Open the workbench ยท All examples
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ReadSecrets",
"Effect": "Allow",
"Action": [
"secretsmanager:GetSecretValue",
"secretsmanager:List*",
"secretsmanager:Describe*"
],
"Resource": "*"
}
]
}
What it allows
- Allows reading secret values, listing and describing all secrets in the account.
What it allows
Allow 5 actions (secretsmanager:GetSecretValue, secretsmanager:List*, secretsmanager:Describe*) on every resource.
Action or pattern Actions Access levels secretsmanager:GetSecretValue1 Read 1 secretsmanager:List*3 List 1, Read 2 secretsmanager:Describe*1 Read 1
Checks
No flags from the six checks.
The wildcard read on all secrets exposes every team's credentials. The wildcards cover 3 and 1 actions.
Least privilege rewrite
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ReadTeamSecrets",
"Effect": "Allow",
"Action": "secretsmanager:GetSecretValue",
"Resource": "*",
"Condition": {
"StringEquals": {
"secretsmanager:ResourceTag/Team": "${aws:PrincipalTag/Team}"
}
}
},
{
"Sid": "ListSecrets",
"Effect": "Allow",
"Action": "secretsmanager:ListSecrets",
"Resource": "*"
}
]
}
The rewrite lets the caller read a secret only when its Team tag matches the caller's Team tag. Listing secrets stays available.
What it allows
Allow 1 action (secretsmanager:GetSecretValue) on every resource when secretsmanager:ResourceTag/Team StringEquals ${aws:PrincipalTag/Team}.
Action or pattern Actions Access levels secretsmanager:GetSecretValue1 Read 1 Allow 1 action (secretsmanager:ListSecrets) on every resource.
Action or pattern Actions Access levels secretsmanager:ListSecrets1 List 1
Checks
No flags from the six checks.
Related pages
Sources
- AWS Secrets Manager User Guide: permissions policy examples, read 16 Nov 2026
- IAM User Guide: attribute-based access control tutorial, read 16 Nov 2026
- AWS Service Authorization Reference, programmatic access (fetched 16 Nov 2026), read 16 Nov 2026
Last reviewed 16 Nov 2026.