說明 EC2 機群的組態、執行個體和事件歷史記錄
您可說明您的 EC2 機群組態、您 EC2 機群中的執行個體,及您 EC2 機群的事件歷史記錄。
說明您所有的 EC2 機群
使用 describe-fleets 命令來說明您所有的 EC2 機群。
aws ec2 describe-fleets
重要
若機群類型為 instant
,則必須指定機群 ID,否則其不會顯示於回應中。包括 --fleet-ids
,如下所示:
aws ec2 describe-fleets --fleet-ids
fleet-8a22eee4-f489-ab02-06b8-832a7EXAMPLE
範例輸出
{
"Fleets": [
{
"ActivityStatus": "fulfilled",
"CreateTime": "2022-02-09T03:35:52+00:00",
"FleetId": "fleet-364457cd-3a7a-4ed9-83d0-7b63e51bb1b7",
"FleetState": "active",
"ExcessCapacityTerminationPolicy": "termination",
"FulfilledCapacity": 2.0,
"FulfilledOnDemandCapacity": 0.0,
"LaunchTemplateConfigs": [
{
"LaunchTemplateSpecification": {
"LaunchTemplateName": "my-launch-template",
"Version": "$Latest"
}
}
],
"TargetCapacitySpecification": {
"TotalTargetCapacity": 2,
"OnDemandTargetCapacity": 0,
"SpotTargetCapacity": 2,
"DefaultTargetCapacityType": "spot"
},
"TerminateInstancesWithExpiration": false,
"Type": "maintain",
"ReplaceUnhealthyInstances": false,
"SpotOptions": {
"AllocationStrategy": "capacity-optimized",
"InstanceInterruptionBehavior": "terminate"
},
"OnDemandOptions": {
"AllocationStrategy": "lowestPrice"
}
}
]
}
說明指定 EC2 機群中的所有執行個體
使用 describe-fleet-instances 命令來說明特定 EC2 Fleet 的執行個體。執行中執行個體的傳回清單會定期重新整理且可能過期。
aws ec2 describe-fleet-instances --fleet-id
fleet-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE
範例輸出
{
"ActiveInstances": [
{
"InstanceId": "i-09cd595998cb3765e",
"InstanceHealth": "healthy",
"InstanceType": "m4.large",
"SpotInstanceRequestId": "sir-86k84j6p"
},
{
"InstanceId": "i-09cf95167ca219f17",
"InstanceHealth": "healthy",
"InstanceType": "m4.large",
"SpotInstanceRequestId": "sir-dvxi7fsm"
}
],
"FleetId": "fleet-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE"
}
說明 EC2 機群的事件歷史記錄
使用 describe-fleet-history 命令來說明特定時間之特定 EC2 機群的事件。如需輸出中所傳回事件的詳細資訊,請參閱 EC2 機群 事件類型。
aws ec2 describe-fleet-history \ --fleet-id
fleet-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE
\ --start-time2018-04-10T00:00:00Z
範例輸出
{
"HistoryRecords": [
{
"EventInformation": {
"EventSubType": "submitted"
},
"EventType": "fleetRequestChange",
"Timestamp": "2020-09-01T18:26:05.000Z"
},
{
"EventInformation": {
"EventSubType": "active"
},
"EventType": "fleetRequestChange",
"Timestamp": "2020-09-01T18:26:15.000Z"
},
{
"EventInformation": {
"EventDescription": "t2.small, ami-07c8bc5c1ce9598c3, ...",
"EventSubType": "progress"
},
"EventType": "fleetRequestChange",
"Timestamp": "2020-09-01T18:26:17.000Z"
},
{
"EventInformation": {
"EventDescription": "{\"instanceType\":\"t2.small\", ...}",
"EventSubType": "launched",
"InstanceId": "i-083a1c446e66085d2"
},
"EventType": "instanceChange",
"Timestamp": "2020-09-01T18:26:17.000Z"
},
{
"EventInformation": {
"EventDescription": "{\"instanceType\":\"t2.small\", ...}",
"EventSubType": "launched",
"InstanceId": "i-090db02406cc3c2d6"
},
"EventType": "instanceChange",
"Timestamp": "2020-09-01T18:26:17.000Z"
}
],
"FleetId": "fleet-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE",
"LastEvaluatedTime": "1970-01-01T00:00:00.000Z",
"StartTime": "2018-04-09T23:53:20.000Z"
}