# IAM policy example: read and write one S3 bucket, with a least privilege rewrite

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

Allows listing one bucket, reading, writing and deleting objects in it, and reading its location. The AWS documentation has a read and write example for a single bucket, and this one starts from the wider s3:* form. The rewrite replaces it with three object actions and two bucket actions.

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "BucketAdmin",
      "Effect": "Allow",
      "Action": "s3:*",
      "Resource": [
        "arn:aws:s3:::amzn-s3-demo-bucket",
        "arn:aws:s3:::amzn-s3-demo-bucket/*"
      ]
    }
  ]
}
```

## What it allows

- Allows every S3 action on the bucket and all objects in it, including deleting the bucket and changing its policy.

- Allows 180 actions (s3:*) on arn:aws:s3:::amzn-s3-demo-bucket, arn:aws:s3:::amzn-s3-demo-bucket/*.

Checks:
- No flags.

The s3:* action covers 180 actions, including bucket deletion and policy changes.

## Least privilege rewrite

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "ListBucket",
      "Effect": "Allow",
      "Action": [
        "s3:ListBucket",
        "s3:GetBucketLocation"
      ],
      "Resource": "arn:aws:s3:::amzn-s3-demo-bucket"
    },
    {
      "Sid": "ObjectReadWrite",
      "Effect": "Allow",
      "Action": [
        "s3:GetObject",
        "s3:PutObject",
        "s3:DeleteObject"
      ],
      "Resource": "arn:aws:s3:::amzn-s3-demo-bucket/*"
    }
  ]
}
```

The rewrite splits bucket actions from object actions and lists the three object actions the application uses. Bucket deletion and policy changes are no longer possible.

- Allows 2 actions (s3:ListBucket, s3:GetBucketLocation) on arn:aws:s3:::amzn-s3-demo-bucket.
- Allows 3 actions (s3:GetObject, s3:PutObject, s3:DeleteObject) on arn:aws:s3:::amzn-s3-demo-bucket/*.

Checks:
- No flags.

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

## Related pages

- [IAM policy example: give each user an S3 home folder](/examples/s3-home-folder-by-username/)
- [IAM policy example: deny S3 requests without TLS](/examples/s3-deny-non-tls-requests/)
- [IAM policy example: require KMS encryption on S3 uploads](/examples/s3-put-with-kms-encryption/)
- [All of them](/examples/)

## Sources

- IAM User Guide: S3 read and write access to one bucket: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_examples_s3_rw-bucket.html (read 16 Nov 2026)
- Amazon S3 User Guide: identity-based policy examples: https://docs.aws.amazon.com/AmazonS3/latest/userguide/example-policies-s3.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/s3-read-write-one-bucket/

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