阿里云负载均衡(SLB(是一种流量分配控制服务,根据配置的转发规则,在多个ECS实例之间分配传入流量。
我正在尝试使用以下提到的代码创建服务器负载平衡实例:
from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.acs_exception.exceptions import ClientException
from aliyunsdkcore.acs_exception.exceptions import ServerException
from aliyunsdkslb.request.v20140515 import CreateLoadBalancerRequest
# Create the AcsClient instance
client = AcsClient(
"<your-access-key-id>",
"<your-access-key-secret>",
"<your-region-id>"
);
但无法创造。
我感谢对此的任何帮助。
要创建 SLB,您需要更多代码: https://www.alibabacloud.com/help/doc-detail/62375.htm
# Create an SLB instance
request = CreateLoadBalancerRequest.CreateLoadBalancerRequest()
request.set_LoadBalancerName('MyLoadBalancer')
request.set_AddressType('internet')
request.set_InternetChargeType('paybytraffic')
response = client.do_action_with_exception(request)
print response