百度智能云

All Product Document

          Cloud Compute Service

          BccClient

          BccClient is the client of BCC service. It provides a series of methods for developers to interact with the BCC service, including instance, disk, image, snapshot, security group and zone.

          Access BCC Through AK/SK

          You can create a BccClient by using the following codes:

          class  sample_default_host():
          
              def setUp(self):
          
                    AK = 'your-access-key-id'                   # User’s Access Key ID
          
                    SK = 'your-secret-access-key'            #User’s Secret Access Key
          
                    # Initialize a BccClient.
          
                    config = BceClientConfiguration(credentials=BceCredentials(AK, SK))
          
                    client = bcc_client.BccClient(config)

          The variables AK and SK are assigned to users by the system in above codes, and they are string. They are used to identify users and conduct the signature authentication for accessing BCC.

          The variable AK corresponds to "Access Key ID" on the console, and the variable SK corresponds to "Access Key Secret" on the console. For the access method, see Access AK/SK .

          Above method uses the default domain name (Beijing region) as the BCC service address. If you want to specify your own domain name, you can specify it by transferring the parameter endpoint.

          class  sample_customize_host():
          
              def setUp(self):
          
                    AK = 'your-access-key-id'                   # User’s Access Key ID
          
                    SK = 'your-secret-access-key'            # User’s Secret Access Key
          
                    HOST = 'domain-name'                      # ser-specified domain name, please refer to below for domain name selection [Region List]
          
                    # Initialize a BccClient.
          
                    config = BceClientConfiguration(credentials=BceCredentials(AK, SK),endpoint = HOST)
          
                    client = bcc_client.BccClient(config)

          Note: The parameter endpoint can be only defined by the specified domain name containing the region. If it is not specified, it is Beijing region by default.http://bcc.bj.baidubce.com

          For the region supported by BCC, see Region List.

          Previous
          Initialization
          Next
          Instance