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

Facts read 16 Nov 2026. Page reviewed 16 Nov 2026.

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.

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

## What it allows

- Allows every SNS action on all topics and subscriptions.

- Allows 41 actions (sns:*) on every resource.

Checks:
- high: Allows 22 write or permissions-management actions (3 permissions management) on every resource ("Resource": "*"). (https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html)

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

## Least privilege rewrite

```json
{
  "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.

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

Checks:
- No flags.

- [Paste it into the workbench](/)
- [Every SNS action and its access level](/actions/sns/)

## Related pages

- [IAM policy example: put events on one EventBridge bus](/examples/eventbridge-put-events-to-one-bus/)
- [IAM policy example: pull images from one ECR repository](/examples/ecr-pull-images-from-one-repository/)
- [IAM policy example: push images to one ECR repository](/examples/ecr-push-images-to-one-repository/)
- [All of them](/examples/)

## Sources

- Amazon SNS Developer Guide: identity-based policies: https://docs.aws.amazon.com/sns/latest/dg/sns-using-identity-based-policies.html (read 16 Nov 2026)
- Amazon SNS Developer Guide: access policy use cases: https://docs.aws.amazon.com/sns/latest/dg/sns-access-policy-use-cases.html (read 16 Nov 2026)
- AWS Service Authorization Reference, programmatic access (fetched 16 Nov 2026): https://docs.aws.amazon.com/service-authorization/latest/reference/service-reference.html (read 16 Nov 2026)

Last reviewed 16 Nov 2026. Canonical: https://iampolicygenerator.com/examples/sns-publish-to-one-topic/

This site is not affiliated with Amazon Web Services. AWS service and product names are used only to describe AWS services.
