Method: AWS::S3::BucketCollection#create
- Defined in:
- lib/aws/s3/bucket_collection.rb
#create(bucket_name, options = {}) ⇒ Bucket
Note:
If your bucket name contains one or more periods and it is hosted in a non-US region, you should make requests against the bucket using the S3 endpoint specific to the region in which your bucket resides. For example:
s3 = AWS::S3.new(:s3_endpoint => "s3-eu-west-1.amazonaws.com")
bucket = s3.buckets.create("my.eu.bucket")
For a full list of endpoints and regions, see Regions and Endpoints in the Amazon Web Services General Reference.
Creates and returns a new Bucket. For example:
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/aws/s3/bucket_collection.rb', line 79 def create bucket_name, = {} # auto set the location constraint for the user if it is not # passed in and the endpoint is not the us-standard region. don't # override the location constraint though, even it is wrong, unless config.s3_endpoint == 's3.amazonaws.com' or [:location_constraint] then constraint = case config.s3_endpoint when 's3-eu-west-1.amazonaws.com' then 'EU' when /^s3-(.*)\.amazonaws\.com$/ then $1 end [:location_constraint] = constraint if constraint end client.create_bucket(.merge(:bucket_name => bucket_name)) bucket_named(bucket_name) end |