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


Python AutoScalingGroup.LaunchConfigurationName方法代码示例

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


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

示例1: LaunchConfiguration

# 需要导入模块: from troposphere.autoscaling import AutoScalingGroup [as 别名]
# 或者: from troposphere.autoscaling.AutoScalingGroup import LaunchConfigurationName [as 别名]
consul_block_device_mapping.Ebs = consul_block_device

consul_launch_config = LaunchConfiguration(config['name'] + 'ConsulLaunchConfig')
consul_launch_config.AssociatePublicIpAddress = True
consul_launch_config.EbsOptimized = config['consul_launch_config']['ebs_optimized']
consul_launch_config.ImageId = config['consul_launch_config']['image_id']
consul_launch_config.KeyName = config['consul_launch_config']['key_name']
consul_launch_config.InstanceType = config['consul_launch_config']['instance_type']
consul_launch_config.BlockDeviceMappings = [consul_block_device_mapping]
consul_launch_config.SecurityGroups = [Ref(config['name'] + 'homeSsh'), Ref(consul_sg)]
t.add_resource(consul_launch_config)

# auto scale group for consul server
consul_asg = AutoScalingGroup(config['name'] + 'ConsulAsg')
consul_asg.AvailabilityZones = config['consul_asg']['availability_zones']
consul_asg.LaunchConfigurationName = Ref(consul_launch_config)
consul_asg.MaxSize = config['consul_asg']['max_size']
consul_asg.MinSize = config['consul_asg']['min_size']
consul_asg.VPCZoneIdentifier = [Ref(subnet.title) for subnet in app_subnets]
name_tag = {'Key': 'Name', 'Value': config['consul_asg']['instance_name'], 'PropagateAtLaunch': True}
consul_asg.Tags = [name_tag]
t.add_resource(consul_asg)

# launch configuration for application
block_device = EBSBlockDevice(config['name'] + 'Ebs')
block_device.DeleteOnTermination = config['app_launch_config']['block_device']['delete_on_termination']

block_device_mapping = BlockDeviceMapping(config['name'] + 'BlockDeviceMapping')
block_device_mapping.DeviceName = '/dev/sda1'
block_device_mapping.Ebs = block_device
开发者ID:cfortier2,项目名称:cs90-final,代码行数:32,代码来源:final-project.py


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