DescribeSpotFleetRequestHistory 搭配 CLI 使用 - Amazon Elastic Compute Cloud

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

DescribeSpotFleetRequestHistory 搭配 CLI 使用

下列程式碼範例示範如何使用 DescribeSpotFleetRequestHistory

CLI
AWS CLI

描述 Spot 機群歷史記錄

此範例命令會從指定的時間開始傳回指定 Spot 機群的歷史記錄。

命令:

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

下列範例輸出顯示 Spot 機群的兩個 Spot 執行個體成功啟動。

輸出:

{ "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" }
PowerShell
for PowerShell 工具

範例 1:此範例說明指定 Spot 機群請求的歷史記錄。

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

輸出:

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

輸出:

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

如需 AWS SDK 開發人員指南和程式碼範例的完整清單,請參閱 使用 建立 Amazon EC2 資源 AWS SDK。本主題也包含有關入門的資訊,以及先前 SDK 版本的詳細資訊。