IAM policy example: list S3 buckets in the console, with a least privilege rewrite
Facts read 16 Nov 2026. Page reviewed 16 Nov 2026.
Allows a principal to see the list of buckets in the account and each bucket's Region, which the S3 console needs on its first page. Nothing in it reads objects. The original grants s3:List* on all resources, which is wider than the console page needs.
Open the workbench ยท All examples
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ListAllBuckets",
"Effect": "Allow",
"Action": [
"s3:List*",
"s3:GetBucketLocation"
],
"Resource": "*"
}
]
}
What it allows
- Allows every S3 list action on every resource, plus the bucket location lookup.
What it allows
Allow 19 actions (s3:List*, s3:GetBucketLocation) on every resource.
Action or pattern Actions Access levels s3:List*18 List 18 s3:GetBucketLocation1 Read 1
Checks
No flags from the six checks.
The wildcard s3:List* covers 18 actions and applies to all resources, which includes object listings in every bucket.
Least privilege rewrite
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ListAllBuckets",
"Effect": "Allow",
"Action": [
"s3:ListAllMyBuckets",
"s3:GetBucketLocation"
],
"Resource": "*"
}
]
}
The rewrite names the two actions the console bucket list uses. Object listings in individual buckets now need their own statement.
What it allows
Allow 2 actions (s3:ListAllMyBuckets, s3:GetBucketLocation) on every resource.
Action or pattern Actions Access levels s3:ListAllMyBuckets1 List 1 s3:GetBucketLocation1 Read 1
Checks
No flags from the six checks.
Related pages
Sources
- Amazon S3 User Guide: identity-based policy examples, read 16 Nov 2026
- AWS Service Authorization Reference, programmatic access (fetched 16 Nov 2026), read 16 Nov 2026
Last reviewed 16 Nov 2026.