当前位置: 首页>>代码示例>>Python>>正文


Python AutoScalingGroup.LoadBalancerNames方法代码示例

本文整理汇总了Python中troposphere.autoscaling.AutoScalingGroup.LoadBalancerNames方法的典型用法代码示例。如果您正苦于以下问题:Python AutoScalingGroup.LoadBalancerNames方法的具体用法?Python AutoScalingGroup.LoadBalancerNames怎么用?Python AutoScalingGroup.LoadBalancerNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在troposphere.autoscaling.AutoScalingGroup的用法示例。


在下文中一共展示了AutoScalingGroup.LoadBalancerNames方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: LaunchConfiguration

# 需要导入模块: from troposphere.autoscaling import AutoScalingGroup [as 别名]
# 或者: from troposphere.autoscaling.AutoScalingGroup import LoadBalancerNames [as 别名]
app_launch_config = LaunchConfiguration(config['name'] + 'LaunchConfig')
app_launch_config.AssociatePublicIpAddress = True
app_launch_config.EbsOptimized = config['app_launch_config']['ebs_optimized']
app_launch_config.ImageId = config['app_launch_config']['image_id']
app_launch_config.KeyName = config['app_launch_config']['key_name']
app_launch_config.InstanceType = config['app_launch_config']['instance_type']
app_launch_config.BlockDeviceMappings = [block_device_mapping]
app_launch_config.SecurityGroups = [Ref(config['name'] + 'homeSsh'), Ref(consul_sg), Ref(elb_sg)]
t.add_resource(app_launch_config)

# auto scale group for application
app_asg = AutoScalingGroup(config['name'] + 'Asg')
app_asg.AvailabilityZones = config['app_asg']['availability_zones']
app_asg.LaunchConfigurationName = Ref(app_launch_config)
app_asg.LoadBalancerNames = [Ref(load_balancer)]
app_asg.MaxSize = config['app_asg']['max_size']
app_asg.MinSize = config['app_asg']['min_size']
app_asg.VPCZoneIdentifier = [Ref(subnet.title) for subnet in app_subnets]
name_tag = {'Key': 'Name', 'Value': config['app_asg']['instance_name'], 'PropagateAtLaunch': True}
app_asg.Tags = [name_tag]
t.add_resource(app_asg)

# print the template to screen
print(t.to_json())

# write to file
cloudformation_file = 'final-project.json'
f = open(cloudformation_file, 'w')
f.write(t.to_json())
f.close()
开发者ID:cfortier2,项目名称:cs90-final,代码行数:32,代码来源:final-project.py


注:本文中的troposphere.autoscaling.AutoScalingGroup.LoadBalancerNames方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。