All Documents
Current Document

Content is empty

If you don't find the content you expect, please try another search term

Documentation

Access KS3 resources from KEC instances by using an internal endpoint

Last updated:2023-06-07 11:34:34

If you access KS3 resources from KEC instances with the read permission on the resources by using an internal endpoint of KS3, no fees are charged for the traffic generated. This topic describes how to access KS3 resources from KEC instances by using an internal endpoint of KS3.

Obtain the internal endpoint of KS3

  • Obtain the internal endpoint in the KS3 console

    Log in to the KS3 console. On the Bucket Details page of the KS3 bucket that you want to access, you can obtain the endpoints and bucket domain names in the Access Domain Name section.

  • Follow the fixed format

    KS3 bucket domain names are in the following format: Endpoint/BucketName. In this format, Endpoint indicates the endpoint used to access KS3 in the region where your bucket resides, and BucketName indicates the name of your bucket. For more information, see Use KS3 endpoints.

Access KS3 resources from KEC instances in the same region

KEC instances can access KS3 resources in the same region over the internal network.

  • Use URLs to access KS3 resources

    You can use internal URLs to access KS3 resources that you are authorized to access. For example, a bucket named aaa resides in the CN North 1(Beijing) region. The bucket contains an object named bbb.png in its root directory, and the object is publicly readable. In this case, KEC instances in the CN North 1(Beijing) region can access this object by using http://aaa.ks3-cn-beijing-internal.ksyuncs.com/bbb.png.

  • Use KS3Util to access KS3 resources

    When you set the parameters for KS3Util, set Endpoint to the internal endpoint of KS3. For more information, see KS3Util command-line tool.

  • Use an SDK to access KS3 resources

    When you initialize the client of an SDK, specify the internal endpoint of KS3.

    • SDK for Java

      Ks3ClientConfig config = new Ks3ClientConfig();
      config.setEndpoint("ks3-cn-beijing-internal.ksyuncs.com");
      Ks3 client = new Ks3Client("<Your AccessKeyID>","<Your SecretAccessKey>",config);

      For more information, see SDK for Java initialization.

    • SDK for PHP

      $client = new Ks3Client("<Your AccessKeyID>","<Your SecretAccessKey>","endpoint")

      For more information, see SDK for PHP initialization.

    • SDK for Python

      from ks3.connection import Connection
      ak = 'YOUR_ACCESS_KEY'
      sk = 'YOUR_SECRET_KEY'
      c = Connection(ak, sk, host='YOUR_REGION_ENDPOINT', is_secure=False, domain_mode=False)

      For more information, see SDK for Python initialization.

    • SDK for C#

      String accessKey = "YOUR ACCESS KEY";
      String secretKey = "YOUR SECRET KEY";
      String bucketName = "YOUR BUCKET NAME";
      String objKeyName = "YOUR OBJECT KEY";
      String endPoint = "ks3-cn-beijing-internal.ksyuncs.com";    // In this example, the internal endpoint of KS3 in the CN North 1(Beijing) region is used.
      ks3Client = new KS3Client(accessKey, secretKey);
      ks3Client.setEndpoint(endPoint);

      For more information, see SDK for C# initialization.

    • SDK for Go

      credentials := credentials.NewStaticCredentials("<AccessKeyID>","<SecretAccessKey>","")
      client := s3.New(&aws.Config{
      Region: "BEIJING",
      Credentials: credentials,
      Endpoint:"ks3-cn-beijing-internal.ksyuncs.com",// The internal endpoint of KS3.
      DisableSSL:true,// Specifies whether to disable HTTPS.
      LogLevel:1,// Specifies whether to enable logging. 0: disable. 1: enable.
      S3ForcePathStyle:false,// Specifies whether to forcibly uses path-style access.
      LogHTTPBody:true,// Specifies whether to record HTTP request bodies in logs.
      Logger:os.Stdout,// Specifies the file to which logs are written.
      })

      For more information, see SDK for Go initialization.

On this page
Pure ModeNormal Mode

Pure Mode

Click to preview the document content in full screen
Feedback