All Products
Search
Document Center

Object Storage Service:Create an OSS on CloudBox bucket

Last Updated:Mar 19, 2026

OSS on CloudBox lets you monitor and process data locally on your CloudBox appliance, which is suitable for workloads that require low latency or centralized management across multiple branches.

Prerequisites

Before you begin, ensure that you have:

OSS on CloudBox is available only in the following regions: China (Hangzhou), China (Shanghai), China (Shenzhen), China (Heyuan), China (Beijing), and China (Chengdu).

Create a bucket

Use the OSS console

  1. Log on to the OSS console.

  2. In the left-side navigation pane, choose Data Service > OSS on CloudBox Buckets, then click Create Bucket in the upper-left corner.

  3. In the Create Bucket panel, configure the parameters described in the following table, then click Creation Completed.

ParameterDescription
Bucket nameA unique name for the bucket within the cloud box. The name must be 3–63 characters, contain only lowercase letters, digits, and hyphens (-), and start and end with a lowercase letter or digit. Avoid including sensitive information such as account numbers in the bucket name — the name appears in object URLs.
RegionThe region where the purchased cloud box is located.
Cloud Box IDThe ID of the purchased cloud box.
EndpointAuto-populated after you select the region and cloud box ID. Two endpoints are assigned: a control endpoint for management operations (<CloudBox-ID>.<Region>.oss-cloudbox-control.aliyuncs.com) and a data endpoint for object read/write operations (<CloudBox-ID>.<Region>.oss-cloudbox.aliyuncs.com). Use the data endpoint in your application code.
Storage classFixed to Standard.
Redundancy typeFixed to LRS.
ACLControls who can read from and write to the bucket. Private (default) — only the bucket owner can read and write; Public Read — anyone can read, only the owner can write; Public Read/Write — anyone can read and write. Setting the ACL to Public Read or Public Read/Write exposes your data to the internet and may result in unintended access and unexpected fees.
VersioningControls whether overwritten or deleted objects are retained as previous versions. Not Activated (default) — objects are permanently deleted when overwritten or removed. Activate — overwritten or deleted objects are saved as previous versions, allowing recovery. For details, see Versioning.
Encryption methodServer-side encryption for objects stored in the bucket. None (default) — encryption is disabled. OSS-Managed — OSS encrypts objects using AES-256 and manages the keys.

Use OSS SDK for Java

You can create an OSS on CloudBox bucket only by using OSS SDK for Java. OSS SDK for Java 3.15.0 or later is required.

All bucket creation requests use the data endpoint and must include both the region and cloud box ID as client configuration. The two key parameters are bucketName and cloudBoxId.

import com.aliyun.oss.ClientException;
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.aliyun.oss.OSSException;
import com.aliyun.oss.model.CreateBucketRequest;
import com.aliyun.oss.common.auth.DefaultCredentialProvider;
import com.aliyun.oss.common.comm.SignVersion;
import com.aliyun.oss.ClientBuilderConfiguration;
import com.aliyun.oss.common.auth.CredentialsProviderFactory;
import com.aliyun.oss.common.auth.EnvironmentVariableCredentialsProvider;

public class Demo {

    public static void main(String[] args) throws Exception {
        // Data endpoint of the OSS on CloudBox bucket
        String endpoint = "https://cb-f8z7yvzgwfkl9q0h****.cn-hangzhou.oss-cloudbox.aliyuncs.com";
        // Load credentials from environment variables OSS_ACCESS_KEY_ID and OSS_ACCESS_KEY_SECRET
        EnvironmentVariableCredentialsProvider credentialsProvider = CredentialsProviderFactory.newEnvironmentVariableCredentialsProvider();
        // Bucket name
        String bucketName = "examplebucket";
        // Region where the cloud box is located
        String region = "cn-hangzhou";
        // Cloud box ID
        String cloudBoxId = "cb-f8z7yvzgwfkl9q0h****";

        // Build the OSS client — call shutdown() to release resources when done
        ClientBuilderConfiguration conf = new ClientBuilderConfiguration();
        conf.setSignatureVersion(SignVersion.V4);
        OSS ossClient = OSSClientBuilder.create()
                .endpoint(endpoint)
                .credentialsProvider(new DefaultCredentialProvider(credentialsProvider.getCredentials()))
                .clientConfiguration(conf)
                .region(region)
                .cloudBoxId(cloudBoxId)
                .build();

        try {
            CreateBucketRequest createBucketRequest = new CreateBucketRequest(bucketName);

            // Optional: set the ACL. Default is private.
            // createBucketRequest.setCannedACL(CannedAccessControlList.PublicRead);

            // Create the bucket
            ossClient.createBucket(createBucketRequest);
        } catch (OSSException oe) {
            System.out.println("Caught an OSSException, which means your request made it to OSS, "
                    + "but was rejected with an error response for some reason.");
            System.out.println("Error Message:" + oe.getErrorMessage());
            System.out.println("Error Code:" + oe.getErrorCode());
            System.out.println("Request ID:" + oe.getRequestId());
            System.out.println("Host ID:" + oe.getHostId());
        } catch (ClientException ce) {
            System.out.println("Caught an ClientException, which means the client encountered "
                    + "a serious internal problem while trying to communicate with OSS, "
                    + "such as not being able to access the network.");
            System.out.println("Error Message:" + ce.getMessage());
        } finally {
            if (ossClient != null) {
                ossClient.shutdown();
            }
        }
    }
}

Use ossutil

For the ossutil command and options, see put-bucket.

Use the OSS API

For high-customization scenarios, call the RESTful API directly. Signature calculation must be included in your code. For details, see PutBucket.