A bucket is a container for objects stored in OSS. Every object is contained in a bucket. This topic describes how to create a bucket.

The following code provides an example on how to call Client#create_bucket to create a bucket with a specified name:

require 'aliyun/oss'

client = Aliyun::OSS::Client.new(
  endpoint: 'endpoint',
  access_key_id: 'AccessKeyId', access_key_secret: 'AccessKeySecret')

client.create_bucket('my-bucket')

		
Note
  • For more information about the bucket naming conventions, see Bucket.
  • The name of a bucket must be globally unique in OSS and cannot be changed after the bucket is created.
  • For more information about endpoints, see Regions and endpoints.
  • For more information about how to create a bucket, see PutBucket.