# 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.

```json
{
  "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.

- Allows 19 actions (s3:List*, s3:GetBucketLocation) on every resource.

Checks:
- No flags.

The wildcard s3:List* covers 18 actions and applies to all resources, which includes object listings in every bucket.

## Least privilege rewrite

```json
{
  "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.

- Allows 2 actions (s3:ListAllMyBuckets, s3:GetBucketLocation) on every resource.

Checks:
- No flags.

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

## Related pages

- [IAM policy example: upload to one S3 prefix](/examples/s3-upload-only-prefix/)
- [IAM policy example: limit S3 access to a VPC endpoint](/examples/s3-access-only-from-vpc-endpoint/)
- [IAM policy example: read EC2 inventory](/examples/ec2-describe-read-only/)
- [All of them](/examples/)

## Sources

- 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-list-buckets-console/

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