Deployment group
Updated at:2025-10-20
Create a deployment group
Create a deployment group based on given creation parameters with the following code:
Plain Text
1# !/usr/bin/env python
2# coding=utf-8
3from baidubce.services.bcc import bcc_client
4from baidubce.auth.bce_credentials import BceCredentials
5from baidubce.bce_client_configuration import BceClientConfiguration
6if __name__ == '__main__':
7# Set your AK, SK, and the region to be accessed
8 HOST = b'http://bcc.bj.baidubce.com'
9 AK = b'ak'
10 SK = b'sk'
11# Set default configuration
12 config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
13 endpoint=HOST)
14# Create a BCC client
15 client = bcc_client.BccClient(config)
16
17 response = client.create_deploy_set(name="your deploy set name", # deployment group name, optional
18 strategy="HOST_HA", # deployment group strategy, optional, default value: HOST_HA, optional values: HOST_HA, RACK_HA, TOR_HA
19 concurrency=5, # deployment group concurrency, optional, default value: 1
20 desc="your deploy set description") # Deployment group description, optional
21 print(response)
Query the deployment group list
You can query the list and detailed information of all deployment group instances with the following code:
Plain Text
1# !/usr/bin/env python
2# coding=utf-8
3from baidubce.services.bcc import bcc_client
4from baidubce.auth.bce_credentials import BceCredentials
5from baidubce.bce_client_configuration import BceClientConfiguration
6if __name__ == '__main__':
7# Set your AK, SK, and the region to be accessed
8 HOST = b'http://bcc.bj.baidubce.com'
9 AK = b'ak'
10 SK = b'sk'
11# Set default configuration
12 config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
13 endpoint=HOST)
14# Create a BCC client
15 client = bcc_client.BccClient(config)
16# Request to query the deployment group list, and return the full deployment group information of the account
17 response = client.list_deploy_sets()
18 print(response)
Modify deployment group attributes
Modify the specified attribute value of a specified deployment group with the following code:
Plain Text
1# !/usr/bin/env python
2# coding=utf-8
3from baidubce.services.bcc import bcc_client
4from baidubce.auth.bce_credentials import BceCredentials
5from baidubce.bce_client_configuration import BceClientConfiguration
6if __name__ == '__main__':
7# Set your AK, SK, and the region to be accessed
8 HOST = b'http://bcc.bj.baidubce.com'
9 AK = b'ak'
10 SK = b'sk'
11# Set default configuration
12 config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
13 endpoint=HOST)
14# Create a BCC client
15 client = bcc_client.BccClient(config)
16
17 response = client.modify_deploy_set(deploy_set_id='dset-******', # deployment group ID, required
18 name="modify-new-name", # deployment group name, optional
19 desc="modify new description") # Deployment group description, optional
20 print(response)
Delete a specified deployment group
Delete a deployment group specified with the following code.
Plain Text
1# !/usr/bin/env python
2# coding=utf-8
3from baidubce.services.bcc import bcc_client
4from baidubce.auth.bce_credentials import BceCredentials
5from baidubce.bce_client_configuration import BceClientConfiguration
6if __name__ == '__main__':
7# Set your AK, SK, and the region to be accessed
8 HOST = b'http://bcc.bj.baidubce.com'
9 AK = b'ak'
10 SK = b'sk'
11# Set default configuration
12 config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
13 endpoint=HOST)
14# Create a BCC client
15 client = bcc_client.BccClient(config)
16
17# Request to delete a deployment group
18 response = client.delete_deploy_set(deploy_set_id='dset-*******') # Deployment group ID, required
19 print(response)
Bind a specified deployment group
Bind a deployment group specified by you with the following code:
Plain Text
1def test_update_instance_deploy(self):
2 """
3 test case for update_instance_deploy
4 """
5 resp = self.client.update_instance_deploy(instance_id='iid1', deployset_id_list=['did1', 'did2'], force=True)
6 self.assertEqual(
7 type(resp),
8 baidubce.bce_response.BceResponse)
9 if resp is not None and resp.content is not None:
10 print(json.loads(resp.content.decode('utf-8')))
11 else:
12 print(resp)
Unbind a specified deployment group
Unbind a deployment group specified by you with the following code:
Plain Text
1def test_del_instance_deploy(self):
2 """
3 test case for del_instance_deploy
4 """
5 resp = self.client.del_instance_deploy(instance_id_list=['iid1', 'iid2'], deploy_set_id='dsid')
6 self.assertEqual(
7 type(resp),
8 baidubce.bce_response.BceResponse)
9 if resp is not None and resp.content is not None:
10 print(json.loads(resp.content.decode('utf-8')))
11 else:
12 print(resp)
