github.com/jmbataller/terraform@v0.6.8-0.20151125192640-b7a12e3a580c/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  * `spot_type` - (Optional; Default: "persistent") If set to "one-time", after
    55    the instance is terminated, the spot request will be closed. Also, Terraform
    56    can't manage one-time spot requests, just launch them.
    57  
    58  ## Attributes Reference
    59  
    60  The following attributes are exported:
    61  
    62  * `id` - The Spot Instance Request ID.
    63  
    64  These attributes are exported, but they are expected to change over time and so
    65  should only be used for informational purposes, not for resource dependencies:
    66  
    67  * `spot_bid_status` - The current [bid
    68    status](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-bid-status.html)
    69    of the Spot Instance Request.
    70  * `spot_request_state` The current [request
    71    state](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-requests.html#creating-spot-request-status)
    72    of the Spot Instance Request.
    73  * `spot_instance_id` - The Instance ID (if any) that is currently fulfilling
    74    the Spot Instance request.
    75  * `public_dns` - The public DNS name assigned to the instance. For EC2-VPC, this 
    76    is only available if you've enabled DNS hostnames for your VPC
    77  * `public_ip` - The public IP address assigned to the instance, if applicable.
    78  * `private_dns` - The private DNS name assigned to the instance. Can only be 
    79    used inside the Amazon EC2, and only available if you've enabled DNS hostnames 
    80    for your VPC
    81  * `private_ip` - The private IP address assigned to the instance