View a markdown version of this page

Use DescribeSpotFleetRequestHistory with a CLI - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use DescribeSpotFleetRequestHistory with a CLI

The following code examples show how to use DescribeSpotFleetRequestHistory.

CLI
AWS CLI

To describe Spot fleet history

The following describe-spot-fleet-request-history example returns the history for the specified Spot fleet starting at the specified time.

aws ec2 describe-spot-fleet-request-history \ --spot-fleet-request-id sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE \ --start-time 2015-05-26T00:00:00Z

The following example output shows the successful launches of two Spot Instances for the Spot fleet.

Output:

{ "HistoryRecords": [ { "Timestamp": "2015-05-26T23:17:20.697Z", "EventInformation": { "EventSubType": "submitted" }, "EventType": "fleetRequestChange" }, { "Timestamp": "2015-05-26T23:17:20.873Z", "EventInformation": { "EventSubType": "active" }, "EventType": "fleetRequestChange" }, { "Timestamp": "2015-05-26T23:21:21.712Z", "EventInformation": { "InstanceId": "i-1234567890abcdef0", "EventSubType": "launched" }, "EventType": "instanceChange" }, { "Timestamp": "2015-05-26T23:21:21.816Z", "EventInformation": { "InstanceId": "i-1234567890abcdef1", "EventSubType": "launched" }, "EventType": "instanceChange" } ], "SpotFleetRequestId": "sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE", "NextToken": "CpHNsscimcV5oH7bSbub03CI2Qms5+ypNpNm+53MNlR0YcXAkp0xFlfKf91yVxSExmbtma3awYxMFzNA663ZskT0AHtJ6TCb2Z8bQC2EnZgyELbymtWPfpZ1ZbauVg+P+TfGlWxWWB/Vr5dk5d4LfdgA/DRAHUrYgxzrEXAMPLE=", "StartTime": "2015-05-26T00:00:00Z" }

For more information, see Describe a Spot Fleet request, its instances, and event history in the Amazon EC2 User Guide.

PowerShell
Tools for PowerShell V4

Example 1: This example describes the history of the specified Spot fleet request.

Get-EC2SpotFleetRequestHistory -SpotFleetRequestId sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE -StartTime 2015-12-26T00:00:00Z

Output:

HistoryRecords : {Amazon.EC2.Model.HistoryRecord, Amazon.EC2.Model.HistoryRecord...} LastEvaluatedTime : 12/26/2015 8:29:11 AM NextToken : SpotFleetRequestId : sfr-088bc5f1-7e7b-451a-bd13-757f10672b93 StartTime : 12/25/2015 8:00:00 AM
(Get-EC2SpotFleetRequestHistory -SpotFleetRequestId sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE -StartTime 2015-12-26T00:00:00Z).HistoryRecords

Output:

EventInformation EventType Timestamp ---------------- --------- --------- Amazon.EC2.Model.EventInformation fleetRequestChange 12/26/2015 8:23:33 AM Amazon.EC2.Model.EventInformation fleetRequestChange 12/26/2015 8:23:33 AM Amazon.EC2.Model.EventInformation fleetRequestChange 12/26/2015 8:23:33 AM Amazon.EC2.Model.EventInformation launched 12/26/2015 8:25:34 AM Amazon.EC2.Model.EventInformation launched 12/26/2015 8:25:05 AM
Tools for PowerShell V5

Example 1: This example describes the history of the specified Spot fleet request.

Get-EC2SpotFleetRequestHistory -SpotFleetRequestId sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE -StartTime 2015-12-26T00:00:00Z

Output:

HistoryRecords : {Amazon.EC2.Model.HistoryRecord, Amazon.EC2.Model.HistoryRecord...} LastEvaluatedTime : 12/26/2015 8:29:11 AM NextToken : SpotFleetRequestId : sfr-088bc5f1-7e7b-451a-bd13-757f10672b93 StartTime : 12/25/2015 8:00:00 AM
(Get-EC2SpotFleetRequestHistory -SpotFleetRequestId sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE -StartTime 2015-12-26T00:00:00Z).HistoryRecords

Output:

EventInformation EventType Timestamp ---------------- --------- --------- Amazon.EC2.Model.EventInformation fleetRequestChange 12/26/2015 8:23:33 AM Amazon.EC2.Model.EventInformation fleetRequestChange 12/26/2015 8:23:33 AM Amazon.EC2.Model.EventInformation fleetRequestChange 12/26/2015 8:23:33 AM Amazon.EC2.Model.EventInformation launched 12/26/2015 8:25:34 AM Amazon.EC2.Model.EventInformation launched 12/26/2015 8:25:05 AM