Expand description
Provides an EC2 Spot Instance Request resource. This allows instances to be requested on the spot market.
By default this provider creates Spot Instance Requests with a persistent
type,
which means that for the duration of their lifetime, AWS will launch an
instance with the configured details if and when the spot market will accept
the requested price.
On destruction, this provider will make an attempt to terminate the associated Spot Instance if there is one present.
Spot Instances requests with a one-time
type will close the spot request
when the instance is terminated either by the request being below the current spot
price availability or by a user.
NOTE: Because their behavior depends on the live status of the spot market, Spot Instance Requests have a unique lifecycle that makes them behave differently than other resources. Most importantly: there is no guarantee that a Spot Instance exists to fulfill the request at any given point in time. See the AWS Spot Instance documentation for more information.
**NOTE AWS strongly discourages the use of the legacy APIs called by this resource. We recommend using the EC2 Instance resource with
instance_market_options
instead.
§Example Usage
resources:
# Request a spot instance at $0.03
cheapWorker:
type: aws:ec2:SpotInstanceRequest
name: cheap_worker
properties:
ami: ami-1234
spotPrice: '0.03'
instanceType: c4.xlarge
tags:
Name: CheapWorker
Structs§
- Use builder syntax to set the inputs and finish with
build_struct()
.
Functions§
- Registers a new resource with the given unique name and arguments