OSS assigns domain names for each bucket. This topic describes what composes an OSS domain name and how to use an OSS domain name.

Format

All requests except the GetService request to OSS include third level domains. The third level domain names contain the bucket information.

OSS domain names are in format of BucketName.Endpoint. BucketName indicates the name of your bucket. Endpoint indicates the domain name used to access the region where your bucket is located.
Note
  • OSS provides services by using HTTP RESTful APIs. Access to resources in different regions uses different endpoints.
  • OSS provides internal endpoints, public endpoints, and accelerate endpoints for regions. For example, the endpoints used to access the China (Hangzhou) region are as follows:
    • Public endpoint: oss-cn-hangzhou.aliyuncs.com
    • Internal endpoint: oss-cn-hangzhou-internal.aliyuncs.com
    • Accelerate endpoint: oss-accelerate.aliyuncs.com

    You can use the internal endpoint and public endpoint to access the OSS resources in a region without additional configurations. To use the accelerate endpoint to access an OSS bucket in a region, you must enable transfer acceleration for the bucket. For more information, see Configure transfer acceleration.

  • For more information about regions and endpoints, see Regions and endpoints.
  • You can also replace a public endpoint with a custom domain name to access OSS resources. For more information, see Bind a custom domain name or Bind accelerate endpoints.

Use a public endpoint to access OSS

By using a public endpoint, you can access OSS over the Internet. OSS allows you to upload or write data to OSS over the Internet free of charge. Fees are incurred when you download or read data from OSS.

Note For more information about OSS pricing and billing, visit Object Storage Service Pricing and see Billing items and methods.

You can use either of the following methods to access OSS over the Internet:

  • Method 1: Use a URL that includes information about OSS resources. The format of the URL is as follows:
    <Schema>://<Bucket>. <Public Endpoint>/<Object> 
    • Schema: HTTP or HTTPS.
    • Bucket: the name of the OSS bucket.
    • Public Endpoint: the domain name used to access the region where the bucket is located over the Internet. For more information about the endpoints used to access each region, see Regions and endpoints.
    • Object: the path to access the OSS object.

    Example: Your bucket is located in the China (Hangzhou) region. The corresponding OSS region ID is oss-cn-hangzhou. The name of your bucket is abc. The path to access the object is myfile/aaa.txt. The domain name to access the object over the Internet is abc.oss-cn-hangzhou.aliyuncs.com/myfile/aaa.txt.

    Notice
    • This domain name is accessible only when the object ACL is public or public read. If the object ACL is private, you must add signature information.
    • By default, the path of an object must be included in the OSS domain name. If you use a bucket domain name such as abc.oss-cn-hangzhou.aliyuncs.com to access an object, an error is displayed. To access OSS through a bucket domain name, configure static website hosting. For more information, see Static website hosting.

    You can also add the object URL to the HTML file as follows:

    <img class="img-responsive"src="https://abc.oss-cn-hangzhou.aliyuncs.com/mypng/aaa.png" />
  • Method 2: Configure the public endpoint by using the OSS SDK.

    The OSS SDK generates an endpoint by concatenating each operation. A different endpoint is generated for operations on a bucket located in a different region.

    The following code provides an example on how to configure an endpoint by using the OSS SDK for Java when OSSClient is created to perform operations on a bucket located in the China (Hangzhou) region:

    String accessKeyId = "<key>";
      String accessKeySecret = "<secret>";
      String endpoint = "oss-cn-hangzhou.aliyuncs.com";
      OSSClient client = new OSSClient(endpoint, accessKeyId, accessKeySecret);

Use an internal endpoint to access OSS

By using an internal endpoint, you can access OSS over the internal network, which is used for communications between Alibaba Cloud products located within the same region. For example, you can access OSS from an ECS server over the internal network when OSS and the ECS server are located within the same region. The inbound and outbound traffic over the internal network is free of charge. However, fees are incurred when you send requests.

You can use either of the following methods to access OSS over the internal network:

  • Method 1: Use a URL that includes information about OSS resources. The format of the URL is as follows:
    <Schema>://<Bucket>. <Internal Endpoint>/<Object> 
    • Schema: HTTP or HTTPS.
    • Bucket: the name of the OSS bucket.
    • Internal Endpoint: the domain name used to access the region where the bucket is located from an ECS server over the internal network when the bucket and ECS server are located within the same region. For more information about the endpoints to access each region, see Regions and endpoints.
    • Object: the path to access the OSS object.

    Example: Your bucket is located in the China (Hangzhou) region. The corresponding OSS region ID is oss-cn-hangzhou. The name of your bucket is abc. The path to access the object is myfile/aaa.txt. The domain name to access the object over the internal network is abc.oss-cn-hangzhou-internal.aliyuncs.com/myfile/aaa.txt.

  • Method 2: Configure an internal endpoint by using the OSS SDK to access OSS from an ECS server.
    The following code provides an example on how to configure an internal endpoint by using the OSS SDK for Java. The code is used to perform operations on a bucket located in the China (Hangzhou) region:
    String accessKeyId = "<key>";
      String accessKeySecret = "<secret>";
      String endpoint = "oss-cn-hangzhou-internal.aliyuncs.com";
      OSSClient client = new OSSClient(endpoint, accessKeyId, accessKeySecret);
    Notice You can use the internal endpoint to access OSS from the ECS server over the internal network when OSS and the ECS server are located within the same region. If OSS and the ECS server are located in different regions, you cannot use the internal endpoint access OSS from the ECS server over the internal network. For example, your has two OSS buckets and you have purchased an ECS instance located in the China (Beijing) region.
    • One bucket named beijingres is located in the China (Beijing) region. You can use beijingres.oss-cn-beijing-internal.aliyuncs.com to access the resources in beijingres from the ECS instance.
    • The other bucket named qingdaores is located in the China (Qingdao) region. The internal endpoint qingdaores.oss-cn-qingdao-internal.aliyuncs.com cannot be used to access resources in qingdaores from the ECS instance. To access resources in qingdaores from the ECS instance, use the public endpoint qingdaores.oss-cn-qingdao.aliyuncs.com.

Use an accelerate endpoint to access OSS

OSS provides transfer acceleration to improve data upload and download speeds. This feature can improve user experiences in uploads and downloads when you transfer data across countries or continents. To use an accelerate endpoint to access a bucket in OSS, you must enable the transfer acceleration function for the bucket. After you enable transfer acceleration for a bucket, you can access the bucket by using the accelerate endpoint instead of the public endpoint to achieve higher data transmission speed.

For example, if you use a browser to access a public read object myphoto.jpg:
  • Use the following URL when you do not need to use transfer acceleration: https://test.oss-cn-hangzhou.aliyuncs.com/myphoto.jpg
  • Use the following URL to use transfer acceleration: https://test.oss-accelerate.aliyuncs.com/myphoto.jpg

For more information about transfer acceleration, see Transfer acceleration.

Use endpoints that support IPv6 to access OSS

IPv6 is the latest version of the Internet Protocol developed by the Internet Engineering Task Force (IETF) to replace IPv4. IPv6 can provide sufficient IP addresses to meet future requirements. Currently, OSS supports access through dual-stack endpoints that support both IPv4 and IPv6.

You can use a dual-stack endpoint to access your bucket through both IPv4 and IPv6 from your client. Your DNS server resolves the endpoint and returns the OSS server address to you based on the protocol that you use. For example, the endpoint of the China (Hangzhou) region is cn-hangzhou.oss.aliyuncs.com. If you have a bucket named myiotdata in this region, you can access the bucket by using the same endpoint myiotdata.cn-hangzhou.oss.aliyuncs.com through both IPv4 and IPv6 from your client.

The following endpoints support access through IPv6:
  • China (Beijing): cn-beijing.oss.aliyuncs.com
  • China (Shanghai): cn-shanghai.oss.aliyuncs.com
  • China (Hangzhou): cn-hangzhou.oss.aliyuncs.com
  • China (Shenzhen): cn-shenzhen.oss.aliyuncs.com
  • China (Hong Kong): cn-hongkong.oss.aliyuncs.com
  • China (Hohhot): cn-huhehaote.oss.aliyuncs.com