# IAM policy example: let Lambda poll one SQS queue, with a least privilege rewrite

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

Gives a Lambda execution role the SQS actions it uses to poll a queue as an event source: receive, delete and read the queue attributes. The original allows sqs:* on all queues. The rewrite names one queue ARN and three actions.

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

## What it allows

- Allows every SQS action on all queues in every Region.

- Allows 20 actions (sqs:*) on every resource.

Checks:
- high: Allows 11 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 sqs:* covers 20 actions and every queue, including purge, delete and policy changes.

## Least privilege rewrite

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

The rewrite lists the three actions Lambda needs for an SQS trigger on one queue. Purge, delete and send are removed.

- Allows 3 actions (sqs:ReceiveMessage, sqs:DeleteMessage, 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: read one DynamoDB table](/examples/dynamodb-read-one-table/)
- [IAM policy example: read and write one DynamoDB table](/examples/dynamodb-crud-one-table/)
- [IAM policy example: limit DynamoDB items to the caller](/examples/dynamodb-leading-keys-per-user/)
- [All of them](/examples/)

## Sources

- AWS Lambda Developer Guide: permissions: https://docs.aws.amazon.com/lambda/latest/dg/lambda-permissions.html (read 16 Nov 2026)
- 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/lambda-sqs-event-source-permissions/

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