39
41
self.build_filter_params(params, filters)
40
42
return self.get_list('DescribeInstancesV6', params,
41
43
[('item', ReservationV6)])
45
def run_instances(self, image_id, min_count=1, max_count=1,
46
key_name=None, security_groups=None,
47
user_data=None, addressing_type=None,
48
instance_type='m1.small', placement=None,
49
kernel_id=None, ramdisk_id=None,
50
monitoring_enabled=False, subnet_id=None,
51
block_device_map=None):
55
:type image_id: string
56
:param image_id: The ID of the image to run
59
:param min_count: The minimum number of instances to launch
62
:param max_count: The maximum number of instances to launch
64
:type key_name: string
65
:param key_name: The name of the key pair with which to
68
:type security_groups: list of strings
69
:param security_groups: The names of the security groups with
70
which to associate instances
72
:type user_data: string
73
:param user_data: The user data passed to the launched instances
75
:type instance_type: string
76
:param instance_type: The type of instance to run
77
(m1.small, m1.large, m1.xlarge)
79
:type placement: string
80
:param placement: The availability zone in which to launch
83
:type kernel_id: string
84
:param kernel_id: The ID of the kernel with which to
87
:type ramdisk_id: string
88
:param ramdisk_id: The ID of the RAM disk with which to
91
:type monitoring_enabled: bool
92
:param monitoring_enabled: Enable CloudWatch monitoring
95
:type subnet_id: string
96
:param subnet_id: The subnet ID within which to launch
97
the instances for VPC.
99
:type block_device_map:
100
:class:`boto.ec2.blockdevicemapping.BlockDeviceMapping`
101
:param block_device_map: A BlockDeviceMapping data structure
102
describing the EBS volumes associated
106
:return: The :class:`boto.ec2.instance.ReservationV6`
107
associated with the request for machines
109
params = {'ImageId': image_id,
110
'MinCount': min_count,
111
'MaxCount': max_count}
113
params['KeyName'] = key_name
116
for group in security_groups:
117
if isinstance(group, SecurityGroup):
121
self.build_list_params(params, l, 'SecurityGroup')
123
params['UserData'] = base64.b64encode(user_data)
125
params['AddressingType'] = addressing_type
127
params['InstanceType'] = instance_type
129
params['Placement.AvailabilityZone'] = placement
131
params['KernelId'] = kernel_id
133
params['RamdiskId'] = ramdisk_id
134
if monitoring_enabled:
135
params['Monitoring.Enabled'] = 'true'
137
params['SubnetId'] = subnet_id
139
block_device_map.build_list_params(params)
140
return self.get_object('RunInstances', params,
141
ReservationV6, verb='POST')