DescribeScheduledInstances 搭配 AWS SDK或 使用 CLI - Amazon Elastic Compute Cloud

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

DescribeScheduledInstances 搭配 AWS SDK或 使用 CLI

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

CLI
AWS CLI

描述您的排程執行個體

此範例說明指定的排程執行個體。

命令:

aws ec2 describe-scheduled-instances --scheduled-instance-ids sci-1234-1234-1234-1234-123456789012

輸出:

{ "ScheduledInstanceSet": [ { "AvailabilityZone": "us-west-2b", "ScheduledInstanceId": "sci-1234-1234-1234-1234-123456789012", "HourlyPrice": "0.095", "CreateDate": "2016-01-25T21:43:38.612Z", "Recurrence": { "OccurrenceDaySet": [ 1 ], "Interval": 1, "Frequency": "Weekly", "OccurrenceRelativeToEnd": false, "OccurrenceUnit": "" }, "Platform": "Linux/UNIX", "TermEndDate": "2017-01-31T09:00:00Z", "InstanceCount": 1, "SlotDurationInHours": 32, "TermStartDate": "2016-01-31T09:00:00Z", "NetworkPlatform": "EC2-VPC", "TotalScheduledInstanceHours": 1696, "NextSlotStartTime": "2016-01-31T09:00:00Z", "InstanceType": "c4.large" } ] }

此範例說明所有排程執行個體。

命令:

aws ec2 describe-scheduled-instances
PowerShell
適用於 的工具 PowerShell

範例 1:此範例說明指定的排程執行個體。

Get-EC2ScheduledInstance -ScheduledInstanceId sci-1234-1234-1234-1234-123456789012

輸出:

AvailabilityZone : us-west-2b CreateDate : 1/25/2016 1:43:38 PM HourlyPrice : 0.095 InstanceCount : 1 InstanceType : c4.large NetworkPlatform : EC2-VPC NextSlotStartTime : 1/31/2016 1:00:00 AM Platform : Linux/UNIX PreviousSlotEndTime : Recurrence : Amazon.EC2.Model.ScheduledInstanceRecurrence ScheduledInstanceId : sci-1234-1234-1234-1234-123456789012 SlotDurationInHours : 32 TermEndDate : 1/31/2017 1:00:00 AM TermStartDate : 1/31/2016 1:00:00 AM TotalScheduledInstanceHours : 1696

範例 2:此範例說明所有排程執行個體。

Get-EC2ScheduledInstance

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