IAM policy example: upload to one S3 prefix, with a least privilege rewrite
Facts read 16 Nov 2026. Page reviewed 16 Nov 2026.
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
Allow 180 actions (s3:*) on arn:aws:s3:::amzn-s3-demo-bucket, arn:aws:s3:::amzn-s3-demo-bucket/*.
Action or pattern Actions Access levels s3:*180 List 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
Allow 2 actions (s3:PutObject, s3:AbortMultipartUpload) on arn:aws:s3:::amzn-s3-demo-bucket/uploads/*.
Action or pattern Actions Access levels s3:PutObject1 Write 1 s3:AbortMultipartUpload1 Write 1
Checks
No flags from the six checks.
Related pages
Sources
- Amazon S3 User Guide: identity-based policy examples, read 16 Nov 2026
- Amazon S3 User Guide: security best practices, read 16 Nov 2026
- AWS Service Authorization Reference, programmatic access (fetched 16 Nov 2026), read 16 Nov 2026
Last reviewed 16 Nov 2026.