Object Storage Service (OSS) uses globally distributed data centers to implement transfer acceleration. When a request is sent to your bucket, it is parsed and routed to the data center in which the bucket is located over the optimal network path and protocol. The transfer acceleration feature provides an optimized end-to-end solution to accelerate access to OSS over the Internet.
Prerequisites
Real-name registration is completed on the Real-name Registration page.
Scenarios
- Accelerate remote data transfer
For example, forums and online collaboration tools that provide services to users across the globe store data in OSS. However, upload and download speeds vary from region to region and lead to an inconsistent user experience. Transfer acceleration allows users from different regions to access data in OSS over the optimal network path. This accelerates data transfer and improves user experience.
- Accelerate the upload and download of gigabyte-grade and terabyte-grade objects
When users upload or download large objects over long geographical distances, transmission failures may occur due to high network latencies. Transfer acceleration combines optimal route selection, protocol stack tuning, and transmission algorithm optimization to reduce timeouts during the remote transfer of large objects over the Internet. You can combine transfer acceleration with multipart upload and resumable download to develop a solution for uploading and downloading large objects over long distances. For more information, see Multipart upload and Resumable download.
- Accelerate the download of dynamic and cold data
User experience is a driving factor for product competitiveness and customer retention in applications that require high data download speeds, such as photo management applications, games, e-commerce applications, enterprise portal websites, and financial applications. High download speeds are also required to obtain good feedback on social networking applications. You can use transfer acceleration to maximize bandwidth utilization and accelerate data transfer from OSS.
Usage notes
- A period of 30 minutes is required for the action of enabling or disabling transfer acceleration to take effect globally.
- Access is accelerated only when you use an acceleration endpoint to access a bucket for which transfer acceleration is enabled.
- When you use an acceleration endpoint, you can manage only buckets for which transfer acceleration is enabled.
- After you enable transfer acceleration for a bucket, other endpoints of the bucket remain available. In scenarios where transfer acceleration is not required, you can use the default endpoint to prevent unnecessary charges.
- Acceleration endpoints can be accessed only by using API requests that use the HTTP or HTTPS protocol. Access by using API requests that use other protocols such as RTMP is not supported.
- To ensure data security, the protocol used in transmission may be changed from HTTP to HTTPS after the peer end receives the request. In this case, when the client uses an acceleration endpoint to access OSS over HTTP, the protocol recorded in access logs may be HTTPS.
- If you enable transfer acceleration and use an acceleration endpoint to access your bucket, you are charged transfer acceleration fees. For more information about the billing methods of transfer acceleration, see Transfer acceleration fees.
Enable transfer acceleration
After you enable transfer acceleration for a bucket, you can access the bucket by using the default endpoint or one of the following endpoints:
- Global acceleration endpoint: oss-accelerate.aliyuncs.com. Transfer acceleration access points are distributed across the world. You can use this endpoint to accelerate data transfer for buckets in all regions.
- Acceleration endpoint of regions outside the Chinese mainland: oss-accelerate-overseas.aliyuncs.com. Transfer acceleration access points are distributed across regions outside the Chinese mainland. You can use the acceleration endpoint to map a custom domain name without an ICP filing to a bucket in the China (Hong Kong) region or in another region outside the Chinese mainland.
Use the OSS console
- Log on to the OSS console.
- In the left-side navigation pane, click Buckets. On the Buckets page, click the name of the desired bucket.
- In the left-side navigation tree, choose .
- On the Transfer Acceleration page, turn on Transfer Acceleration and click OK in the message that appears.
Use OSS SDKs
The following sample code provides examples on how to enable transfer acceleration by using OSS SDKs for common programming languages. For more information about how to enable transfer acceleration by using OSS SDKs for other programming languages, see Overview.
import com.aliyun.oss.ClientException;
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.aliyun.oss.OSSException;
public class Demo {
public static void main(String[] args) throws Exception {
// In this example, the endpoint of the China (Hangzhou) region is used. Specify your actual endpoint.
String endpoint = "https://oss-cn-hangzhou.aliyuncs.com";
// The AccessKey pair of an Alibaba Cloud account has permissions on all API operations. Using these credentials to perform operations in OSS is a high-risk operation. 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.
String accessKeyId = "yourAccessKeyId";
String accessKeySecret = "yourAccessKeySecret";
// Specify the name of the bucket. Example: examplebucket.
String bucketName = "examplebucket";
// Create an OSSClient instance.
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
try {
// Configure transfer acceleration for the bucket.
// If enabled is set to true, transfer acceleration is enabled. If enabled is set to false, transfer acceleration is disabled.
boolean enabled = true;
ossClient.setBucketTransferAcceleration(bucketName, enabled);
} 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();
}
}
}
}
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 O&M. 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 Endpoint 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')
# Configure transfer acceleration for the bucket.
# If enabled is set to true, transfer acceleration is enabled. If enabled is set to false, transfer acceleration is disabled.
enabled = 'true'
bucket.put_bucket_transfer_acceleration(enabled)
package main
import (
"fmt"
"os"
"github.com/aliyun/aliyun-oss-go-sdk/oss"
)
func HandleError(err error) {
fmt.Println("Error:", err)
os.Exit(-1)
}
func main() {
// Create an OSSClient instance.
// Specify the endpoint of the region in which the bucket is located. For example, if the bucket is located in the China (Hangzhou) region, set the endpoint to https://oss-cn-hangzhou.aliyuncs.com.
// The AccessKey pair of an Alibaba Cloud account has permissions on all API operations. Using these credentials to perform operations in OSS is a high-risk operation. 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.
client, err := oss.New("yourEndpoint", "yourAccessKeyId", "yourAccessKeySecret")
if err != nil {
HandleError(err)
}
// Specify the bucket name.
bucketName := "examplebucket"
// Enable transfer acceleration for the bucket.
// The Enabled parameter specifies whether to enable transfer acceleration. A value of true specifies that transfer acceleration is enabled. A value of false specifies that transfer acceleration is disabled.
accConfig := oss.TransferAccConfiguration{}
accConfig.Enabled = true
err = client.SetBucketTransferAcc(bucketName, accConfig)
if err != nil {
HandleError(err)
}
fmt.Printf("set bucket transfer accelerate success\n")
}
Use RESTful API operations
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 PutBucketTransferAcceleration.
Implementation methods
Use a browser
https://test.oss-cn-shenzhen.aliyuncs.com/myphoto.jpg
with https://test.oss-accelerate.aliyuncs.com/myphoto.jpg
. For more information about how to obtain the URL of an object, see How do I obtain the URL of a single object or the URLs of multiple objects? If the access control list (ACL) of the object you want to access is private, you must sign the access request. Use ossutil
- Replace the endpoint specified in the configuration file of ossutil with an acceleration endpoint
When you use ossutil to access data stored in OSS, replace the endpoint specified in the configuration file with an acceleration endpoint. For more information, see ossutil.
- Add
-e oss-accelerate.aliyuncs.com
to commandsWhen you run commands in ossutil, add the
-e oss-accelerate.aliyuncs.com
option to the commands. The following figure shows how to specify an acceleration endpoint when you run the cp command to upload an object by using ossutil.
Use ossbrowser
The following table describes the parameters that you must configure when you use ossbrowser to access data stored in OSS.
Parameter | Description |
---|---|
Endpoint | Select Customize and enter https://oss-accelerate.aliyuncs.com. |
AccessKeyId and AccessKeySecret | Enter the AccessKey pair of your account. For more information about how to obtain the AccessKey pair, see Obtain an AccessKey pair. Important To ensure data security, we recommend that you log on to ossbrowser by using the AccessKey pair of a RAM user. Before you use the AccessKey pair of a RAM user to log on to ossbrowser, you must grant the following permissions to the RAM user: AliyunOSSFullAccess , AliyunRAMFullAccess , and AliyunSTSAssumeRoleAccess . For more information, see Permission management. |
Preset OSS Path | Specify the access permissions on a bucket or the resources stored in the bucket. The OSS path is in the oss://bucketname/path format. For example, if you are authorized to access only objects or subdirectories in the examplefolder directory of a bucket named examplebucket, enter oss://examplebucket/examplefolder/. |
Examples:

Use OSS SDKs
- Simple upload
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.PutObjectRequest; import java.io.File; public class Demo { public static void main(String[] args) throws Exception { // Specify an acceleration endpoint. In this example, the global acceleration endpoint is used. String endpoint = "https://oss-accelerate.aliyuncs.com"; // The AccessKey pair of an Alibaba Cloud account has permissions on all API operations. Using these credentials to perform operations in OSS is a high-risk operation. 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. String accessKeyId = "yourAccessKeyId"; String accessKeySecret = "yourAccessKeySecret"; // Specify the name of the bucket. Example: examplebucket. String bucketName = "examplebucket"; // Specify the full path of the object. Example: exampledir/exampleobject.txt. Do not include the bucket name in the full path. String objectName = "exampledir/exampleobject.txt"; // Specify the full path of the local file that you want to upload. Example: D:\\localpath\\examplefile.txt. // By default, if you do not specify the path of the local file, the file is uploaded from the local path of the project to which the sample program belongs. String filePath= "D:\\localpath\\examplefile.txt"; // Create an OSSClient instance. OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret); try { // Create a PutObjectRequest object. PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, objectName, filePath); // Optional. Specify the storage class and ACL of the object. // ObjectMetadata metadata = new ObjectMetadata(); // metadata.setHeader(OSSHeaders.OSS_STORAGE_CLASS, StorageClass.Standard.toString()); // metadata.setObjectAcl(CannedAccessControlList.Private); // putObjectRequest.setMetadata(metadata); // Upload the object. ossClient.putObject(putObjectRequest); } 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(); } } } }
- Simple download
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.GetObjectRequest; import java.io.File; public class Demo { public static void main(String[] args) throws Exception { // Specify an acceleration endpoint. In this example, the global acceleration endpoint is used. String endpoint = "https://oss-accelerate.aliyuncs.com"; // The AccessKey pair of an Alibaba Cloud account has permissions on all API operations. Using these credentials to perform operations in OSS is a high-risk operation. 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. String accessKeyId = "yourAccessKeyId"; String accessKeySecret = "yourAccessKeySecret"; // Specify the name of the bucket. Example: examplebucket. String bucketName = "examplebucket"; // Specify the full path of the object. Do not include the bucket name in the full path. Example: testfolder/exampleobject.txt. String objectName = "testfolder/exampleobject.txt"; String filePath = "D:\\localpath\\examplefile.txt"; // Create an OSSClient instance. OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret); try { // Download the object to the specified path on your computer. If a file that has the same name already exists, the downloaded object overwrites the file. If no file that has the same name exists, the downloaded object is saved in the path. // If you do not specify a local path for the downloaded object, the downloaded object is saved to the path of the project to which the sample program belongs. ossClient.getObject(new GetObjectRequest(bucketName, objectName), new File(filePath)); } 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(); } } } }
Test the effect of transfer acceleration
Use ossutil
You can run commands in ossutil to respectively upload an object to OSS by using the default endpoint and the acceleration endpoint. You can compare the time that is used to upload the object to verify the effect of transfer acceleration. The following figure shows the time that OSS takes to upload the myphoto.jpg object by using the default endpoint -e oss-us-west-1.aliyuncs.com
and the time that OSS takes to upload the same object by using the acceleration endpoint -e oss-accelerate.aliyuncs.com
.

Use online tools
You can compare the access speeds when you use the acceleration endpoint and default endpoint to access OSS in different regions. For more information, see The Comparison of OSS Direct Data Transfer and Accelerated Data Transfer in Different Regions.
FAQ
- What are the differences between transfer acceleration and Alibaba Cloud CDN?
Feature Principle Scenario Transfer acceleration Transfer acceleration provides an end-to-end acceleration solution by combining smart scheduling, protocol stack tuning, optimal route selection, and transmission algorithm optimization with OSS server-side configurations. - Accelerate object uploads.
- Accelerate remote object uploads and downloads.
- Accelerate the uploads and downloads of large objects.
- Accelerate the downloads of dynamic objects and cold objects.
Alibaba Cloud CDN Alibaba Cloud CDN uses OSS buckets as origin servers and distributes the content to points of presence (POPs). When users request content, Alibaba Cloud CDN delivers content to users from the nodes that are nearest to the users. This accelerates content delivery. Accelerate content delivery when a large number of users in the same region simultaneously request the same static content. - How do I implement transfer acceleration by using a custom domain name?
After you map a custom domain name to a bucket, you can configure CNAME to map the custom domain name to an acceleration endpoint. For more information, see Map an acceleration endpoint.
- Why am I unable to list buckets by using an acceleration endpoint?
Transfer acceleration takes effect only on domain names in the
https://BucketName.oss-accelerate.aliyuncs.com
format. A domain name in a ListBuckets request does not include a bucket name. Therefore, acceleration endpoints cannot be used to list buckets. To list buckets in a specific region, we recommend that you use the default endpoint of the region, such ashttps://oss-cn-hangzhou.aliyuncs.com
. - Can I use transfer acceleration together with Alibaba Cloud CDN to accelerate access to an OSS bucket?
Yes, you can. To use transfer acceleration together with Alibaba Cloud CDN, enable transfer acceleration and map the accelerated domain name to the OSS bucket. For more information, see Map accelerated domain names.