Create Bucket
Updated at:2025-11-03
Create Bucket
The following code can be used to create a bucket:
Plain Text
1void test_put_bucket(bos_request_options_t *options, bos_string_t bucket,bos_acl_e bos_acl, bos_table_t *resp_headers ) {
2 bos_status_t *s = NULL;
3 s = bos_create_bucket(options, &bucket, bos_acl, &resp_headers);
4 print_headers(resp_headers);
5 log_status(s);
6 if (bos_status_is_ok(s)) {
7 printf("create bucket succeeded\n");
8 } else {
9 printf("create bucket failed\n");
10 }
11}
Note: Since the bucket name is unique across all regions, it is necessary to ensure that the bucketName is not the same as the BucketName on all other regions.
Bucket naming follows the following conventions:
- Only lowercase letters, numbers, and hyphens (-) are allowed.
- Must start with a lowercase letter or a number.
- Length should range between 4-63 bytes.
The bucket created using the above code has private read-write permissions and a standard (Standard) storage class.
