Access to KS3 resources from KEC instances by using the internal endpoint of KS3

Last updated:2021-04-28 11:04:02

instances by using the internal endpoint of KS3

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

Obtain through the internal endpoint of KS3

  • Obtain from the KS3 console

    Log in to the KS3 console. On the Overview tab of the specified bucket, you can view the endpoints and bucket domain names in the Domain Names 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 the region where your bucket is located, and BucketName indicates the name of your bucket. For more information, see Use Rules of KS3 Endpoints.

Access to KS3 resources from KEC instances within the same region

KEC instances deployed within the same region as a KS3 bucket can use the internal network to access resources in the bucket:

  • Use URLs to access to KS3 resources

    You can use the internal endpoint of KS3 to access KS3 resources that you are authorized to access. For example, a bucket named aaa is located in the Beijing region. The bucket contains an object named bbb.png in its root directory, and the object is public read. In this case, KEC instances in the Beijing region can access this object by using http://ks3-cn-beijing-internal.ksyun.com/aaa/bbb.png. You can embed the access URL of the object in your website and provide the URL to KEC users within the same region.

  • Use KS3Util to access to KS3 resources

    When you set the parameters for logging on to KS3Util, set Endpoint to the internal endpoint of KS3. For more information, see KS3Util Command Line Tool.

  • Use SDK to access to KS3 resources

    When you use SDK to initialize the client instance, set Endpoint to the internal endpoint of KS3.

    • Java SDK
    Ks3ClientConfig config = new Ks3ClientConfig();
    config.setEndpoint("ks3-cn-beijing-internal.ksyun.com");
    Ks3 client = new Ks3Client("<Your AccessKeyID>","< Your AccessKeySecret>",config);
    

    For more information, see Java SDK Initialization.

    • PHP SDK
    $client = new Ks3Client("<Your AccessKeyID>","< Your AccessKeySecret>","endpoint")
    

    For more information, see PHP SDK Initialization.

    • Python SDK
    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 [Python SDK Initialization](https://docs.ksyun.com/documents/965#Initialization connection).

    • C# SDK
    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.ksyun.com";    //With Beijing region as an example
    ks3Client = new KS3Client(accessKey, secretKey);
    ks3Client.setEndpoint(endPoint);
    

    For more information, see C# SDK Initialization.

    • GO SDK
    credentials := credentials.NewStaticCredentials("<AccessKeyID>","<AccessKeySecret>","")
    client := s3.New(&aws.Config{
    Region: "BEIJING",
    Credentials: credentials,
    Endpoint:"ks3-cn-beijing-internal.ksyun.com",//ks3 address
    DisableSSL:true,//Disable https
    LogLevel:1,//Enable logging, 0: Disable, 1: Enable
    S3ForcePathStyle:false,//Force the use of path style
    LogHTTPBody:true,//Include HTTP request body in the log
    Logger:os.Stdout,//Logging location
    })
    

    For more information, see GO SDK Initialization.

Did you find the above information helpful?

Unhelpful
Mostly Unhelpful
A little helpful
Helpful
Very helpful

What might be the problems?

Insufficient
Outdated
Unclear or awkward
Redundant or clumsy
Lack of context for the complex system or functionality

More suggestions

0/200

Please give us your feedback.

Submitted

Thank you for your feedback.

问题反馈