# IAM policy example: consume messages from one SQS queue, with a least privilege rewrite

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

Allows a worker to receive and delete messages from one queue and to extend the visibility timeout of a message it holds. The original also allows sending and purging on all queues in the account. The names and the account ID 111122223333 are AWS documentation placeholders.

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "Consume",
      "Effect": "Allow",
      "Action": [
        "sqs:ReceiveMessage",
        "sqs:DeleteMessage",
        "sqs:SendMessage",
        "sqs:PurgeQueue",
        "sqs:ChangeMessageVisibility"
      ],
      "Resource": "arn:aws:sqs:us-east-1:111122223333:*"
    }
  ]
}
```

## What it allows

- Allows receiving, deleting, sending and purging on every queue in one Region and account.

- Allows 5 actions (sqs:ReceiveMessage, sqs:DeleteMessage, sqs:SendMessage, sqs:PurgeQueue, sqs:ChangeMessageVisibility) on arn:aws:sqs:us-east-1:111122223333:*.

Checks:
- No flags.

PurgeQueue deletes every message in the queue at once, and the wildcard queue name applies it to all queues.

## Least privilege rewrite

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "ConsumeOne",
      "Effect": "Allow",
      "Action": [
        "sqs:ReceiveMessage",
        "sqs:DeleteMessage",
        "sqs:ChangeMessageVisibility",
        "sqs:GetQueueAttributes"
      ],
      "Resource": "arn:aws:sqs:us-east-1:111122223333:orders-queue"
    }
  ]
}
```

The rewrite names one queue and four consumer actions. Send and purge are removed.

- Allows 4 actions (sqs:ReceiveMessage, sqs:DeleteMessage, sqs:ChangeMessageVisibility, sqs:GetQueueAttributes) on arn:aws:sqs:us-east-1:111122223333:orders-queue.

Checks:
- No flags.

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

## Related pages

- [IAM policy example: publish to one SNS topic](/examples/sns-publish-to-one-topic/)
- [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/)
- [All of them](/examples/)

## Sources

- Amazon SQS Developer Guide: basic policy examples: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-basic-examples-of-sqs-policies.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/sqs-consume-one-queue/

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