Skip to content
IAM Policy Generator

IAM policy example: publish to one SNS topic, with a least privilege rewrite

Allows a service role to publish messages to one SNS topic, alerts-topic. The original allows sns:* on every topic, which includes subscribing outside addresses. The rewrite names the topic ARN and one action. Resource names and account 111122223333 are placeholders used in AWS documentation.

Open the workbench ยท All examples

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "PublishAny",
      "Effect": "Allow",
      "Action": "sns:*",
      "Resource": "*"
    }
  ]
}

What it allows

  • Allows every SNS action on all topics and subscriptions.

What it allows

  1. Allow 41 actions (sns:*) on every resource.

    Action or patternActionsAccess levels
    sns:*41List 7, Read 10, Write 19, Permissions management 3, Tagging 2

Checks

The action sns:* covers 41 actions, including subscribing an outside endpoint to a topic and changing its policy.

Least privilege rewrite

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "PublishOne",
      "Effect": "Allow",
      "Action": "sns:Publish",
      "Resource": "arn:aws:sns:us-east-1:111122223333:alerts-topic"
    }
  ]
}

The rewrite grants Publish on one topic ARN. Subscribing, deleting topics and changing topic policy are removed.

What it allows

  1. Allow 1 action (sns:Publish) on arn:aws:sns:us-east-1:111122223333:alerts-topic.

    Action or patternActionsAccess levels
    sns:Publish1Write 1

Checks

No flags from the six checks.

Sources

  1. Amazon SNS Developer Guide: identity-based policies, read 16 Nov 2026
  2. Amazon SNS Developer Guide: access policy use cases, read 16 Nov 2026
  3. AWS Service Authorization Reference, programmatic access (fetched 16 Nov 2026), read 16 Nov 2026

Last reviewed 16 Nov 2026.