You can store data in and migrate the data across three zones in the same region by using zone-redundant storage (ZRS). If one zone becomes unavailable, you can continue to access the data that is stored in the other zones. ZRS can provide 99.9999999999% (twelve 9's) data durability and 99.995% service availability.

Scenarios

ZRS provides disaster recovery (DR) at the data center level. If a data center becomes unavailable due to network disconnections, power outages, or other disaster events, OSS continues to provide strongly consistent services. This way, services are not interrupted and your data is not lost during failovers. This helps meet the strict requirements of key business systems for which the recovery time objective (RTO) and the recovery point objective (RPO) must be zero.

Usage notes

  • Supported regions

    ZRS is supported in the following regions: China (Shenzhen), China (Beijing), China (Hangzhou), China (Shanghai), China (Hong Kong), Singapore (Singapore), and Indonesia (Jakarta).

  • Billing description

    ZRS incurs higher costs than locally redundant storage (LRS). For more information, see OSS pricing page.

  • Creation method

    You can enable ZRS for a bucket only when you create the bucket. You can use a migration tool such as ossimport or a migration service such as Data Transport to migrate data from an existing bucket to another bucket for which you enabled ZRS.

Supported storage classes

ZRS supports the Standard and Infrequent Access (IA) storage classes. The following table describes the comparisons between the two storage classes.

Item Standard IA
Data durability 99.9999999999% (twelve 9's) 99.9999999999% (twelve 9's)
Service availability 99.995% 99.50%
Minimum billable size of objects None 64 KB
Minimum storage period None 30 days
Data retrieval fees None Billed based on the size of data that is retrieved. Unit: GB.
Data access Real-time access with a latency of milliseconds Real-time access with a latency of milliseconds
Image processing Supported Supported

Use the OSS console

  1. Log on to the OSS console.
  2. In the left-side navigation pane, click Buckets. On the Buckets page, click Create Bucket.
  3. In the Create Bucket panel, configure parameters. The following table describes the parameters.
    Parameter Required Description
    Bucket Name Yes Specify the name of the bucket The name must meet the following requirements:
    • The bucket name must be globally unique in Alibaba Cloud OSS.
    • The name can contain only lowercase letters, digits, and hyphens (-).
    • The name must start and end with a lowercase letter or a digit.
    • The name must be 3 to 63 characters in length.
    Region Yes Select the region for the bucket.

    To access OSS from an Elastic Compute Service (ECS) instance over the internal network, select the region in which the ECS instance is located. For more information, see OSS domain names.

    Note You must complete real-name registration on the Real-name Registration page before you create a bucket in a region within the Chinese mainland.
    Storage Class Yes Select the storage class for the bucket.
    • Standard: provides highly reliable, highly available, and high-performance object storage services that can handle frequent data access. Standard storage is ideal for storing images for social networking and sharing applications and store data for audio and video applications, large websites, and big data analysis.
    • IA: provides high-durability storage services at prices lower than Standard. Objects of the Infrequent Access (IA) storage class have a minimum storage period of 30 days and a minimum billable size of 64 KB. You can access objects of the IA storage class in real time. However, you are charged data retrieval fees when you access IA objects. IA storage is suitable for data that is infrequently accessed, such as once or twice a month.
    • Archive: provides high-durability storage services at prices lower than Standard and IA. Objects of the Archive storage class have a minimum storage period of 60 days and a minimum billable size of 64 KB. You must restore an Archive object before you can access it. The restoration takes approximately one minute. You are charged for data retrieval fees. Archive storage is ideal for data that needs to be stored for a long period, such as archival data, medical images, scientific materials, and video footage.
    • Cold Archive: provides high-durability storage services at prices lower than Standard, IA, and Archive. Objects of the Cold Archive storage class have a minimum storage period of 180 days and a minimum billable size of 64 KB. You must restore an object of the Cold Archive storage class before you can access it. The amount of time required to restore a Cold Archive object depends on the object size and the restoration mode. You are charged for data retrieval fees when you restore Cold Archive objects. Cold Archive storage is ideal for storing cold data over an ultra-long period of time. Such data includes data that must be retained for an extended period of time due to compliance requirements, raw data that is accumulated over an extended period of time in the big data and AI fields, retained media resources in the film and television industries, and archived videos from the online education industry.
      Note Cold Archive is supported in the following regions: China (Qingdao), China (Beijing), China (Zhangjiakou), China (Hangzhou), China (Shanghai), China (Shenzhen), China (Chengdu), China (Ulanqab), China (Hong Kong), Australia (Sydney), Singapore (Singapore), US (Silicon Valley), Germany (Frankfurt), Malaysia (Kuala Lumpur), Indonesia (Jakarta), India (Mumbai), and UAE (Dubai). To apply for a trial, contact technical support.

    For more information about storage classes, see Overview.

    OSS-HDFS No If you want to access OSS by using JindoSDK to build a data lake, enable OSS-HDFS first.
    Notice
    • OSS-HDFS is supported only in the China (Hangzhou), China (Shanghai), China (Shenzhen), China (Beijing), and China (Zhangjiakou) regions.To apply for a trial, contact technical support. OSS-HDFS cannot be disabled after it is enabled. Exercise caution when you enable OSS-HDFS.
    • OSS-HDFS does not support Archive buckets or Cold Archive buckets.
    Zone-redundant Storage No Specify the redundancy type of the bucket.
    • Enable: After this feature is enabled, OSS data is stored in zone-redundant storage (ZRS) mode. ZRS uses the multi-zone mechanism to distribute user data across three zones within the same region. Even if one zone becomes unavailable due to failures such as power outages and fires, the data is still accessible.
      Notice ZRS is supported in the following regions: China (Shenzhen), China (Beijing), China (Hangzhou), China (Shanghai), China (Hong Kong), Singapore (Singapore), and Indonesia (Jakarta). Extra fees are charged for ZRS. This feature cannot be disabled after it is enabled. Exercise caution when you enable this feature.

      For more information about ZRS, see ZRS.

    • Disable: After ZRS is disabled, the redundancy type of the objects in the bucket is locally redundant storage (LRS). LRS stores the copies of each object across different devices within the same zone. This way, OSS ensures data reliability and availability if two storage devices are damaged at the same time.
    Versioning No Select whether to enable versioning.
    • Enable: If versioning is enabled for a bucket, an object that is overwritten or deleted is saved as a previous version of the object. Versioning allows you to restore objects in a bucket to a previous version, and protects your data from being accidentally overwritten or deleted. For more information, see Overview.
    • Disable: If versioning is disabled for a bucket, the overwritten or deleted data is not saved.
    Access Control List (ACL) Yes Select the bucket ACL.
    • Private: Only the bucket owner can perform read and write operations on objects in the bucket. Other users cannot access the objects in the bucket.
    • Public Read: Only the bucket owner can perform write operations on objects in the bucket. Other users, including anonymous users, can perform only read operations on the objects in the bucket.
      Warning All users on the Internet can access objects in the bucket. This may result in unexpected access to the data in your bucket and unexpectedly high costs. Exercise caution when you set your bucket ACL to Public Read.
    • Public Read/Write: All users, including anonymous users, can perform read and write operations on the objects in the bucket.
      Warning All users on the Internet can access objects in the bucket and write data to the bucket. This may result in unexpected access to the data in your bucket and unexpectedly high fees. If a user uploads prohibited data or information, your legitimate interests and rights may be infringed. Therefore, we recommend that you do not set your bucket ACL to Public Read/Write except in special cases.
    Encryption Method No Select whether to enable server-side encryption for the bucket.
    • Encryption Method: Select an encryption method for the bucket.
      • None: Server-side encryption is disabled.
      • OSS-Managed: Keys managed by OSS are used to encrypt objects in the bucket. OSS uses data keys to encrypt objects. In addition, OSS uses regularly rotated master keys to encrypt data keys.
      • KMS: The default CMK stored in KMS or the specified CMK ID is used to encrypt and decrypt data.

        Before you use SSE-KMS, you must activate KMS. For more information, see activate KMS.

    • Encryption Algorithm:Only 256-bit Advanced Encryption Standard (AES-256) is supported.
    • CMK: You can set this parameter if you select KMS in the Encryption Method section. You can configure the following parameters for a CMK:
      • alias/acs/oss: The default CMK stored in KMS is used to encrypt different objects and decrypt the objects when they are downloaded.
      • CMK ID: The keys generated by a specified CMK are used to encrypt different objects, and the specified CMK ID is recorded in the metadata of the encrypted object. Objects are decrypted when they are downloaded by users who are granted decryption permissions. Before you specify a CMK ID, you must create a normal key or an external key in the same region as the bucket in the KMS console For more information, see Import key material.
    Real-time Log Query No If you want to query OSS access logs of the last seven days free of charge, click Enable.

    For more information about real-time log query, see Real-time log query.

    If you do not need to query real-time logs, keep the default setting, which is Disable.

    Scheduled Backup No If you want to back up your OSS data on a regular basis, click Enable. OSS automatically creates a backup plan to back up data by using Hybrid Backup Recovery (HBR) once a day. The generated backup objects are stored for one week.
    Notice If HBR is not activated or HBR is not authorized to access OSS, scheduled backup plans cannot be created. For more information, see Configure scheduled backup.

    If you do not need to back up your OSS data on a regular basis, keep the default setting, which is Disable.

    Hierarchical Namespace No If you want to rename a directory or an object, enable the hierarchical namespace feature.
    Notice You can enable the hierarchical namespace feature for a bucket only when you create the bucket. The hierarchical namespace feature cannot be disabled after it is enabled for a bucket. After you enable this feature for a bucket, some OSS features are no longer supported for the bucket. For more information about a list of features that are not supported for a bucket for which the hierarchical namespace feature is enabled, see Hierarchical namespace.
  4. Click OK.

Use OSS SDKs

The following sample code shows how to use OSS SDKs for common programming languages to create a bucket for which you enabled ZRS. For information about how to use OSS SDKs for other programming languages to create a bucket for which you enabled ZRS, see Overview.

<?php
if (is_file(__DIR__ . '/../autoload.php')) {
    require_once __DIR__ . '/../autoload.php';
}
if (is_file(__DIR__ . '/../vendor/autoload.php')) {
    require_once __DIR__ . '/../vendor/autoload.php';
}

use OSS\OssClient;
use OSS\Core\OssException;

// Security risks may arise if you use the AccessKey pair of an Alibaba Cloud account to access OSS because the account has permissions on all API operations. We recommend that you use a RAM user to call API operations or perform routine operations and maintenance. To create a RAM user, log on to the RAM console. 
$accessKeyId = "yourAccessKeyId";
$accessKeySecret = "yourAccessKeySecret";
// In this example, the endpoint of the China (Hangzhou) region is used. Specify the endpoint based on your business requirements. 
$endpoint = "http://oss-cn-hangzhou.aliyuncs.com";
// Specify the name of the bucket. Example: examplebucket. 
$bucket= "examplebucket;
try {
    $ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint);
    // Set the storage class of the bucket to Infrequent Access (IA). The default value is Standard. 
    $options = array(
        OssClient::OSS_STORAGE => OssClient::OSS_STORAGE_IA
    );
    // Set the access control list (ACL) of the bucket to public-read. The default value is private. 
    $ossClient->createBucket($bucket, OssClient::OSS_ACL_TYPE_PUBLIC_READ, $options);
} catch (OssException $e) {
    printf(__FUNCTION__ . ": FAILED\n");
    printf($e->getMessage() . "\n");
    return;
}
print(__FUNCTION__ . ": OK" . "\n");        
const OSS = require('ali-oss');

const client = new OSS({
  // Set yourregion to the region in which the bucket is located. For example, if your bucket is located in the China (Hangzhou) region, set yourregion to oss-cn-hangzhou. 
  region: 'yourregion',
  // Security risks may arise if you use the AccessKey pair of an Alibaba Cloud account to access OSS because the account has permissions on all API operations. We recommend that you use a RAM user to call API operations or perform routine O&M. To create a RAM user, log on to the RAM console. 
  accessKeyId: 'yourAccessKeyId',
  accessKeySecret: 'yourAccessKeySecret'
});

// Create the bucket. 
async function putBucket() {
  try {
    const options = {
      storageClass: 'Standard', // By default, the storage class of a bucket is Standard. To set the storage class of the bucket to Archive, set storageClass to Archive. 
      acl: 'private', // By default, the ACL of a bucket is private. To set the ACL of the bucket to public read, set acl to public-read. 
      dataRedundancyType: 'LRS' // By default, the data redundancy type of a bucket is locally redundant storage (LRS). To set the data redundancy type of the bucket to zone-redundant storage (ZRS), set dataRedundancyType to ZRS. 
    }
    // Specify the bucket name. 
    const result = await client.putBucket('examplebucket', options);
    console.log(result);
  } catch (err) {
    console.log(err);
  }
}

putBucket();        
# -*- coding: utf-8 -*-
import oss2

# Security risks may arise if you use the AccessKey pair of an Alibaba Cloud account to access OSS because the account has permissions on all API operations. We recommend that you use a RAM user to call API operations or perform routine operations and maintenance. To create a RAM user, log on to the RAM console. 
auth = oss2.Auth('yourAccessKeyId', 'yourAccessKeySecret')
# Set yourEndpoint to the endpoint of the region in which the bucket is located. For example, if the bucket is located in the China (Hangzhou) region, set yourEndpoint to https://oss-cn-hangzhou.aliyuncs.com. 
# Specify the name of the bucket. Example: examplebucket. 
bucket = oss2.Bucket(auth, 'https://oss-cn-hangzhou.aliyuncs.com', 'examplebucket')

# Create the bucket. 
# The following code provides an example on how to specify the storage class, access control list (ACL), and redundancy type when you create a bucket. 
# In this example, the storage class is Standard, the ACL is private, and the redundancy type is zone-redundant storage (ZRS). 
# bucketConfig = oss2.models.BucketCreateConfig(oss2.BUCKET_STORAGE_CLASS_STANDARD, oss2.BUCKET_DATA_REDUNDANCY_TYPE_ZRS)
# bucket.create_bucket(oss2.BUCKET_ACL_PRIVATE, bucketConfig)
bucket.create_bucket()
using Aliyun.OSS;

// Set yourEndpoint to the endpoint of the region in which the bucket is located. For example, if the bucket is located in the China (Hangzhou) region, set yourEndpoint to https://oss-cn-hangzhou.aliyuncs.com. 
var endpoint = "yourEndpoint";
// Security risks may arise if you use the AccessKey pair of an Alibaba Cloud account to access OSS because the account has permissions on all API operations. We recommend that you use a RAM user to call API operations or perform routine operations and maintenance. To create a RAM user, log on to the RAM console. 
var accessKeyId = "yourAccessKeyId";
var accessKeySecret = "yourAccessKeySecret";
// Specify the bucket name. 
var bucketName = "examplebucket";

// Initialize an OSSClient instance. 
var client = new OssClient(endpoint, accessKeyId, accessKeySecret);
// Create the bucket. 
public void CreateBucket(string bucketName)
{
    try
    {
        var request = new CreateBucketRequest(bucketName);
        // Set the access control list (ACL) of the bucket to public-read (PublicRead). The default value is private. 
        request.ACL = CannedAccessControlList.PublicRead;
        // Set the redundancy type of the bucket to zone-redundant storage (ZRS). 
        request.DataRedundancyType = DataRedundancyType.ZRS;        
        client.CreateBucket(request);
        Console.WriteLine("Create bucket succeeded");
    }
    catch (Exception ex)
    {
        Console.WriteLine("Create bucket failed. {0}", ex.Message);
    }
}
package main

    import (
        "fmt"
        "os"
        "github.com/aliyun/aliyun-oss-go-sdk/oss"
    )

func main() {
    // Create an OSSClient instance. 
    // Set yourEndpoint to the endpoint of the region in which the bucket is located. For example, if the bucket is located in the China (Hangzhou) region, set yourEndpoint to https://oss-cn-hangzhou.aliyuncs.com. Specify the endpoint based on your business requirements. 
    // Security risks may arise if you use the AccessKey pair of an Alibaba Cloud account to access OSS because the account has permissions on all API operations. We recommend that you use a RAM user to call API operations or perform routine operations and maintenance. To create a RAM user, log on to the RAM console. 
    client, err := oss.New("yourEndpoint", "yourAccessKeyId", "yourAccessKeySecret")
    if err != nil {
        fmt.Println("Error:", err)
        os.Exit(-1)
    }

    // Create a bucket named examplebucket of which the storage class is IA (oss.StorageIA), the access control list (ACL) is public-read (oss.ACLPublicRead), and the redundancy type is zone-redundant storage (oss. Redundant ZRS). 
    err = client.CreateBucket("examplebucket", oss.StorageClass(oss.StorageIA), oss.ACL(oss.ACLPublicRead), oss.RedundancyType(oss.RedundancyZRS))
    if err != nil {
        fmt.Println("Error:", err)
        os.Exit(-1)
    }
}
id<OSSCredentialProvider> credentialProvider = [[OSSAuthCredentialProvider alloc] initWithAuthServerUrl:@"<StsServer>"];
OSSClientConfiguration *cfg = [[OSSClientConfiguration alloc] init];
cfg.maxRetryCount = 3;
cfg.timeoutIntervalForRequest = 15;

// If an OSSClient is released, all tasks in the session are canceled and the session becomes invalid. Make sure that the OSSClient is not released before the request is complete. 
// Set Endpoint to the endpoint of the region in which the bucket is located. For example, if the bucket is located in the China (Hangzhou) region, set Endpoint to https://oss-cn-hangzhou.aliyuncs.com. 
OSSClient *client = [[OSSClient alloc] initWithEndpoint:@"Endpoint" credentialProvider:credentialProvider clientConfiguration:cfg];

OSSCreateBucketRequest * create = [OSSCreateBucketRequest new];
// Set the bucket name to examplebucket. 
create.bucketName = @"examplebucket";
// Set the access control list (ACL) of the bucket to private. 
create.xOssACL = @"private";
// Set the storage class of the bucket to Infrequent Access (IA). 
create.storageClass = OSSBucketStorageClassIA;

OSSTask * createTask = [client createBucket:create];

[createTask continueWithBlock:^id(OSSTask *task) {
    if (!task.error) {
        NSLog(@"create bucket success!");
    } else {
        NSLog(@"create bucket failed, error: %@", task.error);
    }
    return nil;
}];            
#include <alibabacloud/oss/OssClient.h>
using namespace AlibabaCloud::OSS;

int main(void)
{
    /* Initialize the account information. */
    /* Security risks may arise if you use the AccessKey pair of an Alibaba Cloud account to access OSS because the account has permissions on all API operations. We recommend that you use a RAM user to call API operations or perform routine operations and maintenance. To create a RAM user, log on to the RAM console. */
    std::string AccessKeyId = "yourAccessKeyId";
    std::string AccessKeySecret = "yourAccessKeySecret";
    /* Set yourEndpoint to the endpoint of the region in which the bucket is located. For example, if the bucket is located in the China (Hangzhou) region, set yourEndpoint to https://oss-cn-hangzhou.aliyuncs.com. */
    std::string Endpoint = "yourEndpoint";
    /* Specify the name of the bucket. Example: examplebucket. */
    std::string BucketName = "examplebucket";

    /* Initialize resources such as network resources. */
    InitializeSdk();

    ClientConfiguration conf;
    OssClient client(Endpoint, AccessKeyId, AccessKeySecret, conf);

    /*Specify the name, storage class, and access control list (ACL) of the bucket. */
    CreateBucketRequest request(BucketName, StorageClass::IA, CannedAccessControlList::PublicReadWrite);
    /* Set the redundancy type of the bucket to zone-redundant storage (ZRS). */
    //request.setDataRedundancyType(DataRedundancyType::ZRS);

    /* Create the bucket. */
    auto outcome = client.CreateBucket(request);

    if (!outcome.isSuccess()) {
        /* Handle exceptions. */
        std::cout << "CreateBucket fail" <<
        ",code:" << outcome.error().Code() <<
        ",message:" << outcome.error().Message() <<
        ",requestId:" << outcome.error().RequestId() << std::endl;
        ShutdownSdk();
        return -1;
    }

    /* Release resources such as network resources. */
    ShutdownSdk();
    return 0;
}

Use ossutil

For more information about how to enable ZRS when you create a bucket by using ossutil, see mb (create buckets).

Use the RESTful API

If your business requires a high level of customization, you can directly call RESTful APIs. To directly call an API, you must include the signature calculation in your code. For more information, see PutBucket