Object Storage Service

Products

Object Storage Service

Documentation > Products > Object Storage Service > OSS Access Domain Use Rules

OSS Access Domain Use Rules

OSS will assign a default access domain for each Bucket. This document introduces the composition rules and use methods of OSS access domain.

OSS Domain Composition Rules

For the network requests of OSS, except for API GetService, all the other domains requested are composed of domains with specified Bucket information.

Access Domain Structure: BucketName.Endpoint.

BucketName is your bucket name and Endpoint is the region domain corresponding to bucket.

Description:

  • OSS provides service externally in the form of HTTP RESTful API, and different access domains are required when accessing different Regions.
  • Endpoint is divided into Intranet and Internet access domains. For example: s3.cn-south-1.jdcloud-oss.com points to the Internet access address of cn-south-1 region. Intranet access address s3-internal.cn-south-1.jdcloud-oss.com points to the Intranet address of cn-south-1 region. When you use OSS in JD Cloud VPC, we suggest that you should use Intranet access domain to upload and download traffic for free. For the Table of Comparisons of Regions and Endpoints, please refer to Access Domains and Regions.
  • You can also replace the OSS Internet access domain to your own domain through Set Customized Domain.

Access OSS Services via Internet

Internet (public network) refers to access to OSS via Internet. Input traffic (reads) generated by Internet access is free and outflow traffic (writes) is chargeable.

**Description: ** For details of OSS cost, please refer to OSS Price Overview.

You can access OSS via Internet by two ways as below:

  • Access method 1: Indicate OSS resources in form of URL in the access. URL composition of OSS is as below:
<Schema>://<Bucket>.<Internet Endpoint>/<Object> 
  • Schema: HTTP or HTTPS
  • Bucket: OSS bucket name
  • Endpoint: Access domain of the region where Bucket locates and you need to fill in the Internet Endpoint
  • Object: Upload to file on OSS

Example: If your region is cn-north-1 (s3.cn-north-1.jdcloud-oss.com), the Bucket name is 123 and the Object access path is myfile/aaa.txt, then your Internet access address is:

123.s3.cn-north-1.jdcloud-oss.com/myfile/aaa.txt

Description:

OSS access domain can only be accessed when it carry Object access path. Only the access domain, e.g. 123.s3.cn-north-1.jdcloud-oss.com will have the error notification.

You can also directly put Object URL in HTML for use, which is shown as below:



<img src="https:// 123.s3.cn-north-1.jdcloud-oss.com/myfile/aaa.png">

  • Access method 2: Configure Internet access domain via OSS SDK.

    OSS SDK will splice the access domains for each of your operations. But you need to set different Endpoints when operating Buckets in different regions.

    Take Java SDK for example, when operating Bucket in cn-north-1, you need to set Endpoint while instantiating class:


    
   public class S3SdkTest{
    public static void main(String[ ] args)  {
        final String accessKey = "<your accesskey>";
        final String secretKey = "<your secretkey>";
        final String endpoint = "https://s3.cn-north-1.jdcloud-oss.com";
        ClientConfiguration config = new ClientConfiguration();
 
        AwsClientBuilder.EndpointConfiguration endpointConfig =
                new AwsClientBuilder.EndpointConfiguration(endpoint, "cn-north-1");
 
        AWSCredentials awsCredentials = new BasicAWSCredentials(accessKey,secretKey);
        AWSCredentialsProvider awsCredentialsProvider = new AWSStaticCredentialsProvider(awsCredentials);
 
        AmazonS3 s3 = AmazonS3Client.builder()
                .withEndpointConfiguration(endpointConfig)
                .withClientConfiguration(config)
                .withCredentials(awsCredentialsProvider)
                .disableChunkedEncoding()
                .withPathStyleAccessEnabled(true)
                .build();
    }
 }
   

Access OSS Services via Intranet

Intranet refers to the Intranet communication network among JD Cloud products, e.g. you access OSS services via Virtual Machines (VM). The input and outflow traffic generated by Intranet are free while others shall be billed.

You can access OSS via Intranet by two ways as below:

  • Access method 1: Indicate OSS resources in form of URL in the access. URL composition of OSS is as below.
<Schema>://<Bucket>.<Intranet Endpoint>/<Object> 
  • Schema: HTTP or HTTPS
  • Bucket: OSS bucket
  • Endpoint: Access domain of the data center where Bucket locates and you need to fill in the Intranet Endpoint
  • Object: Upload to file on OSS Example: If your Region is cn-north-1 (s3-internal.cn-north-1.jdcloud-oss.com), the Bucket name is 123 and the Object access path is myfile/aaa.txt, then your Intranet access address is:
123.s3-internal.cn-north-1.jdcloud-oss.com/myfile/aaa.txt
  • Access method 2: Configure Intranet access domain by using OSS SDK via VM.

    Take Java SDK for example, when operating Bucket in cn-north-1, you need to set Endpoint while instantiating class:


     public class S3SdkTest{
      public static void main(String[ ] args)  {
          final String accessKey = "<your accesskey>";
          final String secretKey = "<your secretkey>";
          final String endpoint = "https://s3-internal.cn-north-1.jdcloud-oss.com";
          ClientConfiguration config = new ClientConfiguration();

          AwsClientBuilder.EndpointConfiguration endpointConfig =
                  new AwsClientBuilder.EndpointConfiguration(endpoint, "cn-north-1");

          AWSCredentials awsCredentials = new BasicAWSCredentials(accessKey,secretKey);
          AWSCredentialsProvider awsCredentialsProvider = new AWSStaticCredentialsProvider(awsCredentials);

          AmazonS3 s3 = AmazonS3Client.builder()
                  .withEndpointConfiguration(endpointConfig)
                  .withClientConfiguration(config)
                  .withCredentials(awsCredentialsProvider)
                  .disableChunkedEncoding()
                  .withPathStyleAccessEnabled(true)
                  .build();
      }
  }

Description:

Intranet between VM and OSS in the same region interworks while Intranet between VM and OSS in the different regions does not but can only use Internet access domain.

For example, your OSS has two Buckets and you purchase VM in cn-north-1 (s3-internal.cn-north-1.jdcloud-oss.com):

  • Where the name of one of these Buckets is examplebeijing and the region is cn-north-1, then you can use s3-internal.cn-north-1.jdcloud-oss.comin ECS in cn-north-1 to access resources of beijingres.
  • The name of the other one Bucket is exampleguangzhou and the region is cn-south-1, then you cannot use Intranet address s3-internal.cn-south-1.jdcloud-oss.comin ECS in cn-north-1 to access OSS but must use Internet address s3.cn-south-1.jdcloud-oss.cominstead.
Update Time:2019-05-28 16:47:16