Skip to content
IAM Policy Generator

IAM policy example: upload to one S3 prefix, with a least privilege rewrite

Allows a principal to write objects under the uploads/ prefix of one bucket and nothing else. The original uses s3:* on the whole bucket, a common first draft for an upload job. The rewrite allows two actions on the prefix: PutObject and AbortMultipartUpload.

Open the workbench ยท All examples

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "Uploads",
      "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 of its objects.

What it allows

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

    Action or patternActionsAccess levels
    s3:*180List 18, Read 66, Write 57, Permissions management 27, Tagging 12

Checks

No flags from the six checks.

The action s3:* covers 180 actions and the resource covers every key, so an upload job could read or delete all data.

Least privilege rewrite

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "UploadsOnly",
      "Effect": "Allow",
      "Action": [
        "s3:PutObject",
        "s3:AbortMultipartUpload"
      ],
      "Resource": "arn:aws:s3:::amzn-s3-demo-bucket/uploads/*"
    }
  ]
}

The rewrite allows PutObject and AbortMultipartUpload on the uploads/ prefix only. Reading, listing and deleting are removed.

What it allows

  1. Allow 2 actions (s3:PutObject, s3:AbortMultipartUpload) on arn:aws:s3:::amzn-s3-demo-bucket/uploads/*.

    Action or patternActionsAccess levels
    s3:PutObject1Write 1
    s3:AbortMultipartUpload1Write 1

Checks

No flags from the six checks.

Sources

  1. Amazon S3 User Guide: identity-based policy examples, read 16 Nov 2026
  2. Amazon S3 User Guide: security best practices, read 16 Nov 2026
  3. AWS Service Authorization Reference, programmatic access (fetched 16 Nov 2026), read 16 Nov 2026

Last reviewed 16 Nov 2026.