github.com/pmcatominey/terraform@v0.7.0-rc2.0.20160708105029-1401a52a5cc5/website/source/docs/providers/aws/r/spot_fleet_request.html.markdown (about) 1 --- 2 layout: "aws" 3 page_title: "AWS: aws_spot_fleet_request" 4 sidebar_current: "docs-aws-resource-spot-fleet-request" 5 description: |- 6 Provides a Spot Fleet Request resource. 7 --- 8 9 # aws\_spot\_fleet\_request 10 11 Provides an EC2 Spot Fleet Request resource. This allows a fleet of Spot 12 instances to be requested on the Spot market. 13 14 ## Example Usage 15 16 ``` 17 # Request a Spot fleet 18 resource "aws_spot_fleet_request" "cheap_compute" { 19 iam_fleet_role = "arn:aws:iam::12345678:role/spot-fleet" 20 spot_price = "0.03" 21 allocation_strategy = "diversified" 22 target_capacity = 6 23 valid_until = "2019-11-04T20:44:20Z" 24 launch_specification { 25 instance_type = "m4.10xlarge" 26 ami = "ami-1234" 27 spot_price = "2.793" 28 } 29 launch_specification { 30 instance_type = "m4.4xlarge" 31 ami = "ami-5678" 32 key_name = "my-key" 33 spot_price = "1.117" 34 availability_zone = "us-west-1a" 35 subnet_id = "subnet-1234" 36 weighted_capacity = 35 37 root_block_device { 38 volume_size = "300" 39 volume_type = "gp2" 40 } 41 } 42 } 43 ``` 44 45 ## Argument Reference 46 47 Most of these arguments directly correspond to the 48 [offical API](http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_SpotFleetRequestConfigData.html). 49 50 * `iam_fleet_role` - (Required) Grants the Spot fleet permission to terminate 51 Spot instances on your behalf when you cancel its Spot fleet request using 52 CancelSpotFleetRequests or when the Spot fleet request expires, if you set 53 terminateInstancesWithExpiration. 54 * `launch_specification` - Used to define the launch configuration of the 55 spot-fleet request. Can be specified multiple times to define different bids 56 across different markets and instance types. 57 58 **Note:** This takes in similar but not 59 identical inputs as [`aws_instance`](instance.html). There are limitations on 60 what you can specify (tags, for example, are not supported). See the 61 list of officially supported inputs in the 62 [reference documentation](http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_SpotFleetLaunchSpecification.html). Any normal [`aws_instance`](instance.html) parameter that corresponds to those inputs may be used. 63 64 * `spot_price` - (Required) The bid price per unit hour. 65 * `target_capacity` - The number of units to request. You can choose to set the 66 target capacity in terms of instances or a performance characteristic that is 67 important to your application workload, such as vCPUs, memory, or I/O. 68 * `allocation_strategy` - Indicates how to allocate the target capacity across 69 the Spot pools specified by the Spot fleet request. The default is 70 lowestPrice. 71 * `excess_capacity_termination_policy` - Indicates whether running Spot 72 instances should be terminated if the target capacity of the Spot fleet 73 request is decreased below the current size of the Spot fleet. 74 * `terminate_instances_with_expiration` - Indicates whether running Spot 75 instances should be terminated when the Spot fleet request expires. 76 * `valid_until` - The end date and time of the request, in UTC ISO8601 format 77 (for example, YYYY-MM-DDTHH:MM:SSZ). At this point, no new Spot instance 78 requests are placed or enabled to fulfill the request. Defaults to 24 hours. 79 80 81 ## Attributes Reference 82 83 The following attributes are exported: 84 85 * `id` - The Spot fleet request ID 86 * `spot_request_state` - The state of the Spot fleet request.