-
-
Save ahoward/77e6fc002dbbb74c6bd2 to your computer and use it in GitHub Desktop.
reliably construct a bucket residing in any region with ruby ruby aws-sdk v1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [a, b].each do |bucket_name| | |
| bucket = AWS::S3.new.buckets[bucket_name] | |
| location_constraint = bucket.location_constraint | |
| s3_endpoint = location_constraint.blank? ? "s3.amazonaws.com" : "s3-#{ location_constraint }.amazonaws.com" | |
| bucket = AWS::S3.new(:s3_endpoint => s3_endpoint).buckets[bucket_name] | |
| end | |
| # and why doesn't the API just do this? WTF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment