vendredi 4 septembre 2015

List S3 Buckets from a specific region

I am using AWS Ruby SDK v2 to get S3 Bucket names. Is there a way to get S3 buckets from a specific region?

The way I do it now:

buckets = s3_client.list_buckets.buckets.map(&:name)
buckets.select { |name| s3_client.get_bucket_location(:bucket => name).location_constraint == @region }

This gets all the buckets I have in buckets. Then I filter ones that are from region I specified with @region.

I would like to be able to do this with making only one request through AWS SDK. Is this possible somehow?




Aucun commentaire:

Enregistrer un commentaire