Baidu AI Cloud
中国站

百度智能云

Load Balance

Initialization

Confirm Endpoint

When confirming the Endpoint configured when you use the SDK, you can first read the section on BLB Access Domain Name in the Developer Guide to understand the Endpoint concept. Baidu AI Cloud currently supports multi-regions. Please see Region Selection Instructions.

Currently support the regions of "Beijing", "Guangzhou", "Suzhou", "Hong Kong", "Wuhan" and "Baoding".

The corresponding information of the service domain name is:

Access region Corresponding Endpoint
bj blb.bj.baidubce.com
gz blb.gz.baidubce.com
su blb.su.baidubce.com
hkg blb.hkg.baidubce.com
fwh blb.fwh.baidubce.com
bd blb.bd.baidubce.com

New BlbClient

Using AK /SK New BlbClient

Access BOS through AK/SK. You can refer to the following code to create BosClient:

import ( 
	 "github.com/baidubce/bce-sdk-go/services/blb" 
    "github.com/baidubce/bce-sdk-go/services/appblb" 
) 
func main() { 
	 // Access Key ID and Secret Access Key of users 
	 ACCESS_KEY_ID, SECRET_ACCESS_KEY := <ak>, <sk> 

	 // User specified Endpoint 
	 ENDPOINT := <domain-name> 

	 // Initialize a BlbClient 
	 blbClient, err := blb.NewClient(AK, SK, ENDPOINT) 
    // Initialize a AppblbClient 
	 appblbClient, err := appblb.NewClient(AK, SK, ENDPOINT) 
} 

In the above code, ACCESS_KEY_ID corresponds to the "Access Key ID" in the console, and SECRET_ACCESS_KEY corresponds to the "Access Key Secret" in the console. For how to obtain it, please see [ACCESSKEY Management](GettingStarted.html#Management ACCESSKEY) in the Operation Guide.

Note: The ENDPOINT parameter can only be defined with the specified domain name of the areas included. If not specified, it defaults to the Beijing area(blb.bj.baidubce.com).

Previous
Installation
Next
Common blb Instance