import os import logging slb_id = 'lb-bp1werfophtsjzfr76njm' # 修改负载均衡权限 slb_client_params = { 'access_key_id': 'LTAIuPbTPL3LDDKN', 'access_key_secret': 'ORcNedKwWuwVtcq4IRFtUDZgS0b1le', 'region_id': 'cn-hangzhou' } # 购买机器权限 create_client_params = { 'access_key_id': 'LTAI4GBWbFvvXoXsSVBe1o9f', 'access_key_secret': 'kRAikWitb4kDxaAyBqNrmLmllMEDO3', 'region_id': 'cn-hangzhou' } # 机器配置 instance_config = { # 使用的镜像信息 'image_id': 'm-bp1e5jx8eqhq22l91xw7', # 设置实例规格 'instance_type': 'ecs.ic5.xlarge', # 选择的交换机 'vswitch_id': 'vsw-bp19lpjwtc6j0p0m9mdc2', # 当前VPC类型的安全组 'security_group_id': 'sg-bp1irhrkr4vfj272hk4y', # 硬盘的大小,单位:G 'disk_size': '200', # 服务器命名 'instance_name': 'ESS-rov-server-[1,2]', # 服务器所在区域 'zone_id': 'cn-hangzhou-h', # 磁盘类型:云盘 'disk_category': 'cloud_efficiency', # 密钥 'key_pair_name': 'stuuudy', # tag 'tags': [{"Key": "ecs", "Value": "rov-server.prod"}] } # 服务启动脚本 start_sh_dir = os.path.dirname(os.path.realpath(__file__)) start_sh_filename = 'rov_server_start.sh' with open(file=os.path.join(start_sh_dir, start_sh_filename), mode='r', encoding='utf-8') as rf: file_content = rf.read() logging.info(f"start sh file content: {file_content}") start_sh = { 'target_dir': '/home/piaoquan_server_sh', 'name': start_sh_filename, 'content': file_content, }