判斷EC2執行個體類型支援的開機模式 - Amazon Elastic Compute Cloud

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

判斷EC2執行個體類型支援的開機模式

您可以使用 AWS CLI 或 [工具] PowerShell 來判斷執行個體類型支援的開機模式。

確定執行個體類型的支援開機模式

您可以使用下列方法來確定執行個體類型的支援開機模式。

AWS CLI

使用 describe-instance-types 命令確定執行個體類型的支援開機模式。--query參數會篩選輸出,以僅傳回支援的開機模式。

下列範例顯示同時m5.2xlarge支援UEFI和舊版BIOS啟動模式。

aws ec2 describe-instance-types --region us-east-1 --instance-types m5.2xlarge --query "InstanceTypes[*].SupportedBootModes"

下列為範例輸出。

[ [ "legacy-bios", "uefi" ] ]

下列範例顯示僅t2.xlarge支援 Legacy BIOS。

aws ec2 describe-instance-types --region us-east-1 --instance-types t2.xlarge --query "InstanceTypes[*].SupportedBootModes"

下列為範例輸出。

[ [ "legacy-bios" ] ]
PowerShell

使用 Get-EC2InstanceType(工具 PowerShell) 指令程式來判斷執行個體類型支援的開機模式。

下列範例顯示同時m5.2xlarge支援UEFI和舊版BIOS啟動模式。

Get-EC2InstanceType -Region us-east-1 -InstanceType m5.2xlarge | Format-List InstanceType, SupportedBootModes

下列為範例輸出。

InstanceType : m5.2xlarge SupportedBootModes : {legacy-bios, uefi}

下列範例顯示僅t2.xlarge支援 Legacy BIOS。

Get-EC2InstanceType -Region us-east-1 -InstanceType t2.xlarge | Format-List InstanceType, SupportedBootModes

下列為範例輸出。

InstanceType : t2.xlarge SupportedBootModes : {legacy-bios}
判斷支援的執行個體類型 UEFI

您可以使用以下方法來確定支持的實例類型UEFI;

AWS CLI

可用的執行個體類型因 AWS 區域而異。若要查看區域UEFI中支援的可用例證類型,請將describe-instance-types指令與--region參數搭配使用。如果您省略--region參數,則會在請求中使用您設定的預設「地區」(Region)。包括--filters參數,將結果範圍定為支援的執行個體類型,以UEFI及將輸出範圍限定為的--query參數InstanceType

aws ec2 describe-instance-types --filters Name=supported-boot-mode,Values=uefi --query "InstanceTypes[*].[InstanceType]" --output text | sort

下列為範例輸出。

a1.2xlarge a1.4xlarge a1.large a1.medium a1.metal a1.xlarge c5.12xlarge ...
PowerShell
PS C:\> Get-EC2InstanceType | ` Where-Object {$_.SupportedBootModes -Contains "uefi"} | ` Sort-Object InstanceType | ` Format-Table InstanceType -GroupBy CurrentGeneration

下列為範例輸出。

CurrentGeneration: False InstanceType ------------ a1.2xlarge a1.4xlarge a1.large a1.medium a1.metal a1.xlarge CurrentGeneration: True InstanceType ------------ c5.12xlarge c5.18xlarge c5.24xlarge c5.2xlarge c5.4xlarge c5.9xlarge ...
判斷支援UEFI安全開機並保留非揮發性變數的執行個體類型

裸機執行個體不支援UEFI安全開機和非揮發性變數,因此這些範例會將它們從輸出中排除。如需有關UEFI安全開機的資訊,請參閱UEFIAmazon EC2 實例的安全啟動

AWS CLI

使用指describe-instance-types令,並透過包括Name=bare-metal,Values=false篩選器,將裸機例證從輸出中排除。

aws ec2 describe-instance-types --filters Name=supported-boot-mode,Values=uefi Name=bare-metal,Values=false --query "InstanceTypes[*].[InstanceType]" --output text | sort

下列為範例輸出。

a1.2xlarge a1.4xlarge a1.large a1.medium ...
PowerShell
PS C:\> Get-EC2InstanceType | ` Where-Object { ` $_.SupportedBootModes -Contains "uefi" -and ` $_.BareMetal -eq $False } | ` Sort-Object InstanceType | ` Format-Table InstanceType, SupportedBootModes, BareMetal, @{Name="SupportedArchitectures"; Expression={$_.ProcessorInfo.SupportedArchitectures}}
InstanceType SupportedBootModes BareMetal SupportedArchitectures ------------ ------------------ --------- ---------------------- a1.2xlarge {uefi} False arm64 a1.4xlarge {uefi} False arm64 a1.large {uefi} False arm64 a1.medium {uefi} False arm64 a1.xlarge {uefi} False arm64 c5.12xlarge {legacy-bios, uefi} False x86_64 c5.18xlarge {legacy-bios, uefi} False x86_64