spot_fleet_requests
Creates, updates, deletes, gets or lists a spot_fleet_requests resource.
Overview
| Name | spot_fleet_requests |
| Type | Resource |
| Id | aws.ec2.spot_fleet_requests |
Fields
The following fields are returned by SELECT queries:
- describe_spot_fleet_requests
| Name | Datatype | Description |
|---|---|---|
activity_status | string | The progress of the Spot Fleet request. If there is an error, the status is error. After all requests are placed, the status is pending_fulfillment. If the size of the fleet is equal to or greater than its target capacity, the status is fulfilled. If the size of the fleet is decreased, the status is pending_termination while Spot Instances are terminating. |
create_time | string | The creation date and time of the request. |
spot_fleet_request_config | string | The configuration of the Spot Fleet request. |
spot_fleet_request_id | string | The ID of the Spot Fleet request. |
spot_fleet_request_state | string | The state of the Spot Fleet request. |
tags | string | The tags for a Spot Fleet resource. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_spot_fleet_requests | select | region | DryRun, SpotFleetRequestId, NextToken, MaxResults | Describes your Spot Fleet requests. Spot Fleet requests are deleted 48 hours after they are canceled and their instances are terminated. |
modify_spot_fleet_request | update | SpotFleetRequestId, region | LaunchTemplateConfig, OnDemandTargetCapacity, Context, TargetCapacity, ExcessCapacityTerminationPolicy | Modifies the specified Spot Fleet request. You can only modify a Spot Fleet request of type maintain. While the Spot Fleet request is being modified, it is in the modifying state. To scale up your Spot Fleet, increase its target capacity. The Spot Fleet launches the additional Spot Instances according to the allocation strategy for the Spot Fleet request. If the allocation strategy is lowestPrice, the Spot Fleet launches instances using the Spot Instance pool with the lowest price. If the allocation strategy is diversified, the Spot Fleet distributes the instances across the Spot Instance pools. If the allocation strategy is capacityOptimized, Spot Fleet launches instances from Spot Instance pools with optimal capacity for the number of instances that are launching. To scale down your Spot Fleet, decrease its target capacity. First, the Spot Fleet cancels any open requests that exceed the new target capacity. You can request that the Spot Fleet terminate Spot Instances until the size of the fleet no longer exceeds the new target capacity. If the allocation strategy is lowestPrice, the Spot Fleet terminates the instances with the highest price per unit. If the allocation strategy is capacityOptimized, the Spot Fleet terminates the instances in the Spot Instance pools that have the least available Spot Instance capacity. If the allocation strategy is diversified, the Spot Fleet terminates instances across the Spot Instance pools. Alternatively, you can request that the Spot Fleet keep the fleet at its current size, but not replace any Spot Instances that are interrupted or that you terminate manually. If you are finished with your Spot Fleet for now, but will use it again later, you can set the target capacity to 0. |
cancel_spot_fleet_requests | exec | SpotFleetRequestId, TerminateInstances, region | DryRun | Cancels the specified Spot Fleet requests. After you cancel a Spot Fleet request, the Spot Fleet launches no new instances. You must also specify whether a canceled Spot Fleet request should terminate its instances. If you choose to terminate the instances, the Spot Fleet request enters the cancelled_terminating state. Otherwise, the Spot Fleet request enters the cancelled_running state and the instances continue to run until they are interrupted or you terminate them manually. Terminating an instance is permanent and irreversible. After you terminate an instance, you can no longer connect to it, and it can't be recovered. All attached Amazon EBS volumes that are configured to be deleted on termination are also permanently deleted and can't be recovered. All data stored on instance store volumes is permanently lost. For more information, see How instance termination works. Before you terminate an instance, ensure that you have backed up all data that you need to retain after the termination to persistent storage. Restrictions You can delete up to 100 fleets in a single request. If you exceed the specified number, no fleets are deleted. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
SpotFleetRequestId | array | The IDs of the Spot Fleet requests. Constraint: You can specify up to 100 IDs in a single request. |
TerminateInstances | boolean | Indicates whether to terminate the associated instances when the Spot Fleet request is canceled. The default is to terminate the instances. To let the instances continue to run after the Spot Fleet request is canceled, specify no-terminate-instances. |
region | string | AWS region (default: us-east-1) |
Context | string | Reserved. |
DryRun | boolean | Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation. |
ExcessCapacityTerminationPolicy | string | Indicates whether running instances should be terminated if the target capacity of the Spot Fleet request is decreased below the current size of the Spot Fleet. Supported only for fleets of type maintain. |
LaunchTemplateConfig | array | The launch template and overrides. You can only use this parameter if you specified a launch template (LaunchTemplateConfigs) in your Spot Fleet request. If you specified LaunchSpecifications in your Spot Fleet request, then omit this parameter. |
MaxResults | integer | The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see Pagination. |
NextToken | string | The token to include in another request to get the next page of items. This value is null when there are no more items to return. |
OnDemandTargetCapacity | integer | The number of On-Demand Instances in the fleet. |
SpotFleetRequestId | array | The IDs of the Spot Fleet requests. |
TargetCapacity | integer | The size of the fleet. |
SELECT examples
- describe_spot_fleet_requests
Describes your Spot Fleet requests. Spot Fleet requests are deleted 48 hours after they are canceled and their instances are terminated.
SELECT
activity_status,
create_time,
spot_fleet_request_config,
spot_fleet_request_id,
spot_fleet_request_state,
tags
FROM aws.ec2.spot_fleet_requests
WHERE region = '{{ region }}' -- required
AND DryRun = '{{ DryRun }}'
AND SpotFleetRequestId = '{{ SpotFleetRequestId }}'
AND NextToken = '{{ NextToken }}'
AND MaxResults = '{{ MaxResults }}'
;
UPDATE examples
- modify_spot_fleet_request
Modifies the specified Spot Fleet request. You can only modify a Spot Fleet request of type maintain. While the Spot Fleet request is being modified, it is in the modifying state. To scale up your Spot Fleet, increase its target capacity. The Spot Fleet launches the additional Spot Instances according to the allocation strategy for the Spot Fleet request. If the allocation strategy is lowestPrice, the Spot Fleet launches instances using the Spot Instance pool with the lowest price. If the allocation strategy is diversified, the Spot Fleet distributes the instances across the Spot Instance pools. If the allocation strategy is capacityOptimized, Spot Fleet launches instances from Spot Instance pools with optimal capacity for the number of instances that are launching. To scale down your Spot Fleet, decrease its target capacity. First, the Spot Fleet cancels any open requests that exceed the new target capacity. You can request that the Spot Fleet terminate Spot Instances until the size of the fleet no longer exceeds the new target capacity. If the allocation strategy is lowestPrice, the Spot Fleet terminates the instances with the highest price per unit. If the allocation strategy is capacityOptimized, the Spot Fleet terminates the instances in the Spot Instance pools that have the least available Spot Instance capacity. If the allocation strategy is diversified, the Spot Fleet terminates instances across the Spot Instance pools. Alternatively, you can request that the Spot Fleet keep the fleet at its current size, but not replace any Spot Instances that are interrupted or that you terminate manually. If you are finished with your Spot Fleet for now, but will use it again later, you can set the target capacity to 0.
UPDATE aws.ec2.spot_fleet_requests
SET
-- No updatable properties
WHERE
SpotFleetRequestId = '{{ SpotFleetRequestId }}' --required
AND region = '{{ region }}' --required
AND LaunchTemplateConfig = '{{ LaunchTemplateConfig}}'
AND OnDemandTargetCapacity = '{{ OnDemandTargetCapacity}}'
AND Context = '{{ Context}}'
AND TargetCapacity = '{{ TargetCapacity}}'
AND ExcessCapacityTerminationPolicy = '{{ ExcessCapacityTerminationPolicy}}'
RETURNING
return;
Lifecycle Methods
- cancel_spot_fleet_requests
Cancels the specified Spot Fleet requests. After you cancel a Spot Fleet request, the Spot Fleet launches no new instances. You must also specify whether a canceled Spot Fleet request should terminate its instances. If you choose to terminate the instances, the Spot Fleet request enters the cancelled_terminating state. Otherwise, the Spot Fleet request enters the cancelled_running state and the instances continue to run until they are interrupted or you terminate them manually. Terminating an instance is permanent and irreversible. After you terminate an instance, you can no longer connect to it, and it can't be recovered. All attached Amazon EBS volumes that are configured to be deleted on termination are also permanently deleted and can't be recovered. All data stored on instance store volumes is permanently lost. For more information, see How instance termination works. Before you terminate an instance, ensure that you have backed up all data that you need to retain after the termination to persistent storage. Restrictions You can delete up to 100 fleets in a single request. If you exceed the specified number, no fleets are deleted.
EXEC aws.ec2.spot_fleet_requests.cancel_spot_fleet_requests
@SpotFleetRequestId='{{ SpotFleetRequestId }}' --required,
@TerminateInstances='{{ TerminateInstances }}' --required,
@region='{{ region }}' --required,
@DryRun={{ DryRun }}
;