1VM::EC2::REST::spot_insUtsaenrceC(o3n)tributed Perl DocuVmMe:n:tEaCt2i:o:nREST::spot_instance(3)
2
3
4
7 use VM::EC2 ':misc';
8
10 These methods allow you to request spot instances and manipulate spot
11 data feed subscriptions.
12
13 Implemented:
14 CancelSpotInstanceRequests
15 CreateSpotDatafeedSubscription
16 DeleteSpotDatafeedSubscription
17 DescribeSpotDatafeedSubscription
18 DescribeSpotInstanceRequests
19 DescribeSpotPriceHistory
20 RequestSpotInstances
21
22 Unimplemented:
23 (none)
24
25 $subscription = $ec2->create_spot_datafeed_subscription($bucket,$prefix)
26 This method creates a spot datafeed subscription. Provide the method
27 with the name of an S3 bucket associated with your account, and a
28 prefix to be appended to the files written by the datafeed. Spot
29 instance usage logs will be written into the requested bucket, and
30 prefixed with the desired prefix.
31
32 If no prefix is specified, it defaults to "SPOT_DATAFEED_";
33
34 On success, a VM::EC2::Spot::DatafeedSubscription object is returned;
35
36 Only one datafeed is allowed per account;
37
38 $boolean = $ec2->delete_spot_datafeed_subscription()
39 This method delete's the current account's spot datafeed subscription,
40 if any. It takes no arguments.
41
42 On success, it returns true.
43
44 $subscription = $ec2->describe_spot_datafeed_subscription()
45 This method describes the current account's spot datafeed subscription,
46 if any. It takes no arguments.
47
48 On success, a VM::EC2::Spot::DatafeedSubscription object is returned;
49
50 @spot_price_history = $ec2->describe_spot_price_history(@filters)
51 This method applies the specified filters to spot instances and returns
52 a list of instances, timestamps and their price at the indicated time.
53 Each spot price history point is represented as a
54 VM::EC2::Spot::PriceHistory object.
55
56 Option arguments are:
57
58 -start_time Start date and time of the desired history
59 data, in the form yyyy-mm-ddThh:mm:ss (GMT).
60 The Perl DateTime module provides a convenient
61 way to create times in this format.
62
63 -end_time End date and time of the desired history
64 data.
65
66 -instance_type The instance type, e.g. "m1.small", can be
67 a scalar value or an arrayref.
68
69 -product_description The product description. One of "Linux/UNIX",
70 "SUSE Linux" or "Windows". Can be a scalar value
71 or an arrayref.
72
73 -availability_zone A single availability zone, such as "us-east-1a".
74
75 -max_results Maximum number of rows to return in a single
76 call.
77
78 -next_token Specifies the next set of results to return; used
79 internally.
80
81 -filter Hashref containing additional filters to apply,
82
83 The following filters are recognized: "instance-type", "product-
84 description", "spot-price", "timestamp", "availability-zone". The '*'
85 and '?' wildcards can be used in filter values, but numeric comparison
86 operations are not supported by the Amazon API. Note that wildcards are
87 not generally allowed in the standard options. Hence if you wish to get
88 spot price history in all availability zones in us-east, this will
89 work:
90
91 $ec2->describe_spot_price_history(-filter=>{'availability-zone'=>'us-east*'})
92
93 but this will return an invalid parameter error:
94
95 $ec2->describe_spot_price_history(-availability_zone=>'us-east*')
96
97 If you specify -max_results, then the list of history objects returned
98 may not represent the complete result set. In this case, the method
99 more_spot_prices() will return true. You can then call
100 describe_spot_price_history() repeatedly with no arguments in order to
101 retrieve the remainder of the results. When there are no more results,
102 more_spot_prices() will return false.
103
104 my @results = $ec2->describe_spot_price_history(-max_results => 20,
105 -instance_type => 'm1.small',
106 -availability_zone => 'us-east*',
107 -product_description=>'Linux/UNIX');
108 print_history(\@results);
109 while ($ec2->more_spot_prices) {
110 @results = $ec2->describe_spot_price_history
111 print_history(\@results);
112 }
113
114 @requests = $ec2->request_spot_instances(%args)
115 This method will request one or more spot instances to be launched when
116 the current spot instance run-hour price drops below a preset value and
117 terminated when the spot instance run-hour price exceeds the value.
118
119 On success, will return a series of VM::EC2::Spot::InstanceRequest
120 objects, one for each instance specified in -instance_count.
121
122 Required arguments:
123 -spot_price The desired spot price, in USD.
124
125 -image_id ID of an AMI to launch
126
127 -instance_type Type of the instance(s) to launch, such as "m1.small"
128
129 Optional arguments:
130 -instance_count Maximum number of instances to launch (default 1)
131
132 -type Spot instance request type; one of "one-time" or "persistent"
133
134 -valid_from Date/time the request becomes effective, in format
135 yyyy-mm-ddThh:mm:ss. Default is immediately.
136
137 -valid_until Date/time the request expires, in format
138 yyyy-mm-ddThh:mm:ss. Default is to remain in
139 effect indefinitely.
140
141 -launch_group Name of the launch group. Instances in the same
142 launch group are started and terminated together.
143 Default is to launch instances independently.
144
145 -availability_zone_group If specified, all instances that are given
146 the same zone group name will be launched into the
147 same availability zone. This is independent of
148 the -availability_zone argument, which specifies
149 a particular availability zone.
150
151 -key_name Name of the keypair to use
152
153 -security_group_id Security group ID to use for this instance.
154 Use an arrayref for multiple group IDs
155
156 -security_group Security group name to use for this instance.
157 Use an arrayref for multiple values.
158
159 -user_data User data to pass to the instances. Do NOT base64
160 encode this. It will be done for you.
161
162 -availability_zone The availability zone you want to launch the
163 instance into. Call $ec2->regions for a list.
164 -zone Short version of -availability_aone.
165
166 -placement_group An existing placement group to launch the
167 instance into. Applicable to cluster instances
168 only.
169 -placement_tenancy Specify 'dedicated' to launch the instance on a
170 dedicated server. Only applicable for VPC
171 instances.
172
173 -kernel_id ID of the kernel to use for the instances,
174 overriding the kernel specified in the image.
175
176 -ramdisk_id ID of the ramdisk to use for the instances,
177 overriding the ramdisk specified in the image.
178
179 -block_devices Specify block devices to map onto the instances,
180 overriding the values specified in the image.
181 See run_instances() for the syntax of this argument.
182
183 -block_device_mapping Alias for -block_devices.
184
185 -network_interfaces Same as the -network_interfaces option in run_instances().
186
187 -monitoring Pass a true value to enable detailed monitoring.
188
189 -subnet The ID of the Amazon VPC subnet in which to launch the
190 spot instance (VPC only).
191
192 -subnet_id deprecated
193
194 -addressing_type Deprecated and undocumented, but present in the
195 current EC2 API documentation.
196
197 -iam_arn The Amazon resource name (ARN) of the IAM Instance Profile (IIP)
198 to associate with the instances.
199
200 -iam_name The name of the IAM instance profile (IIP) to associate with the
201 instances.
202
203 -ebs_optimized If true, request an EBS-optimized instance (certain
204 instance types only).
205
206 @requests = $ec2->cancel_spot_instance_requests(@request_ids)
207 This method cancels the pending requests. It does not terminate any
208 instances that are already running as a result of the requests. It
209 returns a list of VM::EC2::Spot::InstanceRequest objects, whose fields
210 will be unpopulated except for spotInstanceRequestId and state.
211
212 @requests =
213 $ec2->describe_spot_instance_requests(@spot_instance_request_ids)
214 @requests = $ec2->describe_spot_instance_requests(\%filters)
215 @requests =
216 $ec2->describe_spot_instance_requests(-spot_instance_request_id=>\@ids,-filter=>\%filters)
217 This method will return information about current spot instance
218 requests as a list of VM::EC2::Spot::InstanceRequest objects.
219
220 Optional arguments:
221
222 -spot_instance_request_id -- Scalar or arrayref of request Ids.
223
224 -filter -- Tags and other filters to apply.
225
226 There are many filters available, described fully at
227 http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-ItemType-SpotInstanceRequestSetItemType.html:
228
229 availability-zone-group
230 create-time
231 fault-code
232 fault-message
233 instance-id
234 launch-group
235 launch.block-device-mapping.delete-on-termination
236 launch.block-device-mapping.device-name
237 launch.block-device-mapping.snapshot-id
238 launch.block-device-mapping.volume-size
239 launch.block-device-mapping.volume-type
240 launch.group-id
241 launch.image-id
242 launch.instance-type
243 launch.kernel-id
244 launch.key-name
245 launch.monitoring-enabled
246 launch.ramdisk-id
247 launch.network-interface.network-interface-id
248 launch.network-interface.device-index
249 launch.network-interface.subnet-id
250 launch.network-interface.description
251 launch.network-interface.private-ip-address
252 launch.network-interface.delete-on-termination
253 launch.network-interface.group-id
254 launch.network-interface.group-name
255 launch.network-interface.addresses.primary
256 product-description
257 spot-instance-request-id
258 spot-price
259 state
260 status-code
261 status-message
262 tag-key
263 tag-value
264 tag:<key>
265 type
266 launched-availability-zone
267 valid-from
268 valid-until
269
271 VM::EC2
272
274 Lincoln Stein <lincoln.stein@gmail.com>.
275
276 Copyright (c) 2011 Ontario Institute for Cancer Research
277
278 This package and its accompanying libraries is free software; you can
279 redistribute it and/or modify it under the terms of the GPL (either
280 version 1, or at your option, any later version) or the Artistic
281 License 2.0. Refer to LICENSE for the full license text. In addition,
282 please see DISCLAIMER.txt for disclaimers of warranty.
283
285 Hey! The above document had some coding errors, which are explained
286 below:
287
288 Around line 330:
289 You forgot a '=back' before '=head2'
290
291
292
293perl v5.34.0 2021-07-27 VM::EC2::REST::spot_instance(3)