def create_lb(lb_name):
'create a new load balancer'
region = ['ap-southeast-1']
zones = ['none']
subnets = ['subnet-0d0b3379']
ports= [(80, 80, 'http'), (443, 443, 'tcp')]
lb = lb_conn.create_load_balancer(lb_name, zones, subnets, ports)
hc = HealthCheck(
interval=20,
healthy_threshold=3,
unhealthy_threshold=5,
target='HTTP:80/health')
lb.configure_health_check(hc)
print lb.dns_name
使用上面的定义我在vpc中创建lb,但它显示:
<Code>MalformedInput</Code>
请帮我解决此问题。
提前致谢。
答案 0 :(得分:0)
值none
对zones
参数无效。您必须为已创建负载均衡器的区域指定至少一个有效可用区域。
答案 1 :(得分:0)
我更换了“没有”的区域。至 zones = [&#39; ap-southeast-1a&#39;,&#39; ap-southeast-1b&#39;]
仍然显示相同的结果 boto.exception.BotoServerError:BotoServerError:400 Bad Request
答案 2 :(得分:0)
我使用下面的行来创建负载均衡器,
conn = boto.connect_elb()
lb = conn.create_load_balancer(name="lbName", listeners= [(80,80,'http')], zones=None, subnets=["subnet-xxxxxx", "subnet-xxxxxxx", "subnet-xxxxxxx"],security_groups=["sg-xxxxxxx"])
在不同的可用区中选择两个子网,以便为负载均衡器提供更高的可用性。
请忽略此链接(出于某些测试目的):https://stackoverflow.com/questions/25545dfd058/how-tfdfo-create-elb-inside-vpc-using-boto#answer-32311648