retorquere
retorquere

Reputation: 1556

Is it possible to list all the AWS S3 buckets I have access to?

Is it possible to list all the AWS S3 buckets a user has access to? If so, I wouldn't have to set up a separate registry for which user can access which. I can reliably detect which buckets are of interest to my app.

Upvotes: 5

Views: 10388

Answers (2)

Todd Jones
Todd Jones

Reputation: 499

You can list all the S3 buckets under your account using the AWS CLI.

Documentation can be found here: list-buckets - AWS

Here is the command I use (no-verify-ssl optional, of course):
aws --no-verify-ssl s3api list-buckets

This lists all the S3 buckets for the account which I am accessing using the credentials.

Upvotes: 7

Jim Flanagan
Jim Flanagan

Reputation: 2129

The operation to list S3 buckets (GET /) only returns the name of the buckets, and the creation date, and there are no filters on the operation. The only way to do this would be to get a list of the buckets, then iterate over each and make a GET bucket?policy call, parse the policy to get the list of principles, then see if the principal in question is listed. Not very efficient.

You are better off maintaining metadata outside S3 to track this association if you need it to be responsive.

Upvotes: 0

Related Questions