github.com/atsaki/terraform@v0.4.3-0.20150919165407-25bba5967654/website/source/docs/providers/aws/r/spot_instance_request.html.markdown (about)

     1  ---
     2  layout: "aws"
     3  page_title: "AWS: aws_spot_instance_request"
     4  sidebar_current: "docs-aws-resource-spot-instance-request"
     5  description: |-
     6    Provides a Spot Instance Request resource.
     7  ---
     8  
     9  # aws\_spot\_instance\_request
    10  
    11  Provides an EC2 Spot Instance Request resource. This allows instances to be
    12  requested on the spot market.
    13  
    14  Terraform always creates Spot Instance Requests with a `persistent` type, which
    15  means that for the duration of their lifetime, AWS will launch an instance
    16  with the configured details if and when the spot market will accept the
    17  requested price.
    18  
    19  On destruction, Terraform will make an attempt to terminate the associated Spot
    20  Instance if there is one present.
    21  
    22  ~> **NOTE:** Because their behavior depends on the live status of the spot
    23  market, Spot Instance Requests have a unique lifecycle that makes them behave
    24  differently than other Terraform resources. Most importantly: there is __no
    25  guarantee__ that a Spot Instance exists to fulfill the request at any given
    26  point in time. See the [AWS Spot Instance
    27  documentation](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-spot-instances.html)
    28  for more information.
    29  
    30  
    31  ## Example Usage
    32  
    33  ```
    34  # Request a spot instance at $0.03
    35  resource "aws_spot_instance_request" "cheap_worker" {
    36      ami = "ami-1234"
    37      spot_price = "0.03"
    38      instance_type = "c4.xlarge"
    39      tags {
    40          Name = "CheapWorker"
    41      }
    42  }
    43  ```
    44  
    45  ## Argument Reference
    46  
    47  Spot Instance Requests support all the same arguments as
    48  [`aws_instance`](instance.html), with the addition of:
    49  
    50  * `spot_price` - (Required) The price to request on the spot market.
    51  * `wait_for_fulfillment` - (Optional; Default: false) If set, Terraform will
    52    wait for the Spot Request to be fulfilled, and will throw an error if the
    53    timeout of 10m is reached.
    54  
    55  ## Attributes Reference
    56  
    57  The following attributes are exported:
    58  
    59  * `id` - The Spot Instance Request ID.
    60  
    61  These attributes are exported, but they are expected to change over time and so
    62  should only be used for informational purposes, not for resource dependencies:
    63  
    64  * `spot_bid_status` - The current [bid
    65    status](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-bid-status.html)
    66    of the Spot Instance Request.
    67  * `spot_request_state` The current [request
    68    state](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-requests.html#creating-spot-request-status)
    69    of the Spot Instance Request.
    70  * `spot_instance_id` - The Instance ID (if any) that is currently fulfilling
    71    the Spot Instance request.