本文整理汇总了Python中boto.ec2.autoscale.AutoScaleConnection.get_object方法的典型用法代码示例。如果您正苦于以下问题:Python AutoScaleConnection.get_object方法的具体用法?Python AutoScaleConnection.get_object怎么用?Python AutoScaleConnection.get_object使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boto.ec2.autoscale.AutoScaleConnection
的用法示例。
在下文中一共展示了AutoScaleConnection.get_object方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from boto.ec2.autoscale import AutoScaleConnection [as 别名]
# 或者: from boto.ec2.autoscale.AutoScaleConnection import get_object [as 别名]
def main():
parser = optparse.OptionParser()
parser.add_option("-c", "--config", dest="config_file", help="AutoScale config INI", metavar="FILE")
(options, args) = parser.parse_args()
logging.info("Using config file [%s]" % options.config_file)
config = parse_config(options.config_file)
aws_access = config.get("AWS", "access")
aws_secret = config.get("AWS", "secret")
logging.debug("Connecting to AWS with access [%s] and secret [%s]" % (aws_access, aws_secret))
aws_connection = AutoScaleConnection(aws_access, aws_secret)
lc = boto.ec2.autoscale.launchconfig.LaunchConfiguration(
name=config.get("LaunchConfig", "name"),
image_id=config.get("LaunchConfig", "image"),
key_name=config.get("LaunchConfig", "key"),
user_data=config.get("LaunchConfig", "user_data"),
security_groups=config.get("LaunchConfig", "security_groups"),
instance_type=config.get("LaunchConfig", "instance_type"),
)
logging.info("LC CONFIG = %s" % lc.__dict__)
asg = boto.ec2.autoscale.group.AutoScalingGroup(
group_name=config.get("AutoScaleGroup", "group_name"),
availability_zones=config.get("AutoScaleGroup", "zones"),
min_size=config.get("AutoScaleGroup", "min_instances"),
max_size=config.get("AutoScaleGroup", "max_instances"),
launch_config=lc,
)
print "ASG dict: %s" % asg.__dict__
asg.connection = aws_connection
params = {"AutoScalingGroupName": asg.name}
asg = aws_connection.get_object("DescribeAutoScalingGroups", params, boto.ec2.autoscale.group.AutoScalingGroup)
print asg