本文整理匯總了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