summaryrefslogtreecommitdiff
path: root/boto/ec2/autoscale/launchconfig.py
diff options
context:
space:
mode:
authorMitch Garnaat <mitch@garnaat.com>2012-06-04 12:59:04 -0700
committerMitch Garnaat <mitch@garnaat.com>2012-06-04 12:59:04 -0700
commit3035ed1a2426a6e34ba2cb309cae558c98646ade (patch)
tree1ed9dcec764d0205b3c60b6a22bebf585846a407 /boto/ec2/autoscale/launchconfig.py
parent0d598163384e2b9bd178f6db34e5ef264bafafd3 (diff)
downloadboto-3035ed1a2426a6e34ba2cb309cae558c98646ade.tar.gz
Initial support for spot instances in autoscaling groups.
Diffstat (limited to 'boto/ec2/autoscale/launchconfig.py')
-rw-r--r--boto/ec2/autoscale/launchconfig.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/boto/ec2/autoscale/launchconfig.py b/boto/ec2/autoscale/launchconfig.py
index 526f4686..be8e4435 100644
--- a/boto/ec2/autoscale/launchconfig.py
+++ b/boto/ec2/autoscale/launchconfig.py
@@ -1,4 +1,5 @@
# Copyright (c) 2009 Reza Lotun http://reza.lotun.name/
+# Copyright (c) 2012 Amazon.com, Inc. or its affiliates. All Rights Reserved
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
@@ -26,6 +27,8 @@ import boto.utils
import base64
# this should use the corresponding object from boto.ec2
+
+
class Ebs(object):
def __init__(self, connection=None, snapshot_id=None, volume_size=None):
self.connection = connection
@@ -84,12 +87,13 @@ class BlockDeviceMapping(object):
elif name == 'VirtualName':
self.virtual_name = value
+
class LaunchConfiguration(object):
def __init__(self, connection=None, name=None, image_id=None,
key_name=None, security_groups=None, user_data=None,
instance_type='m1.small', kernel_id=None,
ramdisk_id=None, block_device_mappings=None,
- instance_monitoring=False):
+ instance_monitoring=False, spot_price=None):
"""
A launch configuration.
@@ -98,14 +102,14 @@ class LaunchConfiguration(object):
:type image_id: str
:param image_id: Unique ID of the Amazon Machine Image (AMI) which was
- assigned during registration.
+ assigned during registration.
:type key_name: str
:param key_name: The name of the EC2 key pair.
:type security_groups: list
:param security_groups: Names of the security groups with which to
- associate the EC2 instances.
+ associate the EC2 instances.
:type user_data: str
:param user_data: The user data available to launched EC2 instances.
@@ -121,11 +125,15 @@ class LaunchConfiguration(object):
:type block_device_mappings: list
:param block_device_mappings: Specifies how block devices are exposed
- for instances
+ for instances
:type instance_monitoring: bool
:param instance_monitoring: Whether instances in group are launched
- with detailed monitoring.
+ with detailed monitoring.
+
+ :type spot_price: float
+ :param spot_price: The spot price you are bidding. Only applies
+ if you are building an autoscaling group with spot instances.
"""
self.connection = connection
self.name = name
@@ -141,6 +149,7 @@ class LaunchConfiguration(object):
self.user_data = user_data
self.created_time = None
self.instance_monitoring = instance_monitoring
+ self.spot_price = spot_price
self.launch_configuration_arn = None
def __repr__(self):
@@ -181,10 +190,11 @@ class LaunchConfiguration(object):
self.launch_configuration_arn = value
elif name == 'InstanceMonitoring':
self.instance_monitoring = value
+ elif name == 'SpotPrice':
+ self.spot_price = float(value)
else:
setattr(self, name, value)
def delete(self):
""" Delete this launch configuration. """
return self.connection.delete_launch_configuration(self.name)
-