Endpoints

Last Updated: Mar 29, 2017

Composition rules for domain names

With regards to all network requests for the OSS, except those for the GetService API, the domain names are third-level domain names for specific buckets. The domain name is composed of the bucket name and the endpoint: BucketName.Endpoint. Here, Endpoint can vary due to the region (data center) of the bucket and the intranet/Internet access method.

Endpoint naming rules for an external network

Here, external network refers to the Internet.

  1. Region + .aliyuncs.com

Endpoint naming rules for an internal network

Here, internal network refers to Alibaba Cloud’s intranet.

  1. Region + -internal + .aliyuncs.com

OSS regions and endpoints

Refer to Regions and endpoints.

Endpoint settings in the OSS SDK

For each user operation, the OSS SDK has a spliced endpoint. However, users need to set different endpoints when configuring buckets of different regions.

For example, when using a Java SDK, users need to set the endpoint during class instantiation before configuring buckets in the following Hangzhou region:

  1. String accessKeyId = "<key>";
  2. String accessKeySecret = "<secret>";
  3. String endpoint = "http://oss-cn-hangzhou.aliyuncs.com";
  4. OSSClient client = new OSSClient(endpoint, accessKeyId, accessKeySecret);

Use intranet endpoints to access OSS in ECS

Intranet addresses can be used for access between an ECS instance and an OSS instance that are in the same region.

For example, a user has:

  • An ECS instance located in Beijing
  • An OSS bucket which is named beijingres and is located in Beijing
  • An OSS bucket which is named qingdaores and is located in Qingdao
  • Based on the preceding information:
  • The user can access resources in beijingres through the intranet address ‘beijingres.oss-cn-beijing-internal.aliyuncs.com’.
  • The user cannot access qingdaores through the intranet address qingdaores.oss-cn-qingdao. They must instead access the OSS through the Internet address qingdaores.oss-cn-qingdao.aliyuncs.com.

In the preceding sample Java SDK, the Internet address of the bucket is used for OSS access. To access the OSS through the intranet, you only need to modify the endpoint:

  1. String accessKeyId = "<key>";
  2. String accessKeySecret = "<secret>";
  3. String endpoint = "http://oss-cn-hangzhou-internal.aliyuncs.com";
  4. OSSClient client = new OSSClient(endpoint, accessKeyId, accessKeySecret);
Thank you! We've received your feedback.