Skip to content
IAM Policy Generator

IAM policy example: read Secrets Manager secrets by tag, with a least privilege rewrite

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

  1. Allow 5 actions (secretsmanager:GetSecretValue, secretsmanager:List*, secretsmanager:Describe*) on every resource.

    Action or patternActionsAccess levels
    secretsmanager:GetSecretValue1Read 1
    secretsmanager:List*3List 1, Read 2
    secretsmanager:Describe*1Read 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

  1. Allow 1 action (secretsmanager:GetSecretValue) on every resource when secretsmanager:ResourceTag/Team StringEquals ${aws:PrincipalTag/Team}.

    Action or patternActionsAccess levels
    secretsmanager:GetSecretValue1Read 1
  2. Allow 1 action (secretsmanager:ListSecrets) on every resource.

    Action or patternActionsAccess levels
    secretsmanager:ListSecrets1List 1

Checks

No flags from the six checks.

Sources

  1. AWS Secrets Manager User Guide: permissions policy examples, read 16 Nov 2026
  2. IAM User Guide: attribute-based access control tutorial, read 16 Nov 2026
  3. AWS Service Authorization Reference, programmatic access (fetched 16 Nov 2026), read 16 Nov 2026

Last reviewed 16 Nov 2026.