确定实例的启动模式

2024-09-12   访问量:1010

实例的启动模式会在 Amazon EC2 控制台中的启动模式字段中,通过 AWS CLI 中的 currentInstanceBootMode 参数显示。

启动实例时,其启动模式参数的值由启动该实例所用的 AMI 的启动模式参数的值决定,如下所示:

  • 启动模式参数为 uefi 的 AMI 会创建 currentInstanceBootMode 参数为 uefi 的实例。

  • 启动模式参数为 legacy-bios 的 AMI 会创建 currentInstanceBootMode 参数为 legacy-bios 的实例。

  • 如果实例类型支持 UEFI,则启动模式参数为 uefi-preferred 的 AMI 会创建 currentInstanceBootMode 参数为 uefi 的实例;否则将创建 currentInstanceBootMode 参数为 legacy-bios 的实例。

  • 没有启动模式参数值的 AMI 会创建参数值为 currentInstanceBootMode 的实例,该值取决于 AMI 架构是 ARM 还是 x86,以及实例类型支持哪种启动模式。Graviton 实例类型上的默认启动模式为 uefi,而 Intel 和 AMD 实例类型上的默认启动模式为 legacy-bios

确定实例的启动模式(Tools for PowerShell)

使用 Get-EC2Image Cmdlet 确定实例的启动模式。您还可以确定用于创建实例的 AMI 的启动模式。

Get-EC2Image (AWS Tools for Windows PowerShell)

(Get-EC2Instance -InstanceId i-1234567890abcdef0).Instances | Format-List BootMode, CurrentInstanceBootMode, InstanceType, ImageId 
					BootMode                : uefi
CurrentInstanceBootMode : uefi
InstanceType            : c5a.large
ImageId                 : ami-0265446f88eb4021b

在输出中,以下参数对启动模式进行了描述:

  • BootMode – 用于创建实例的 AMI 的启动模式。

  • CurrentInstanceBootMode – 用于在启动时启动实例的启动模式。

确定实例的启动模式 (AWS CLI)

使用 describe-instances 命令确定实例的启动模式。您还可以确定用于创建实例的 AMI 的启动模式。

aws ec2 describe-instances --region us-east-1 --instance-ids i-1234567890abcdef0{
    "Reservations": [        {
            "Groups": [],
            "Instances": [                {
                    "AmiLaunchIndex": 0,
                    "ImageId": "ami-0e2063e7f6dc3bee8",
                    "InstanceId": "i-1234567890abcdef0",
                    "InstanceType": "m5.2xlarge",
                    ... 
                    },
                   "BootMode": "uefi",
                   "CurrentInstanceBootMode": "uefi"
                }
            ],
            "OwnerId": "1234567890",
            "ReservationId": "r-1234567890abcdef0"
        }
    ]
}


确定实例的启动模式(Tools for PowerShell)

使用 Get-EC2Image Cmdlet 确定实例的启动模式。您还可以确定用于创建实例的 AMI 的启动模式。

Get-EC2Image (AWS Tools for Windows PowerShell)

(Get-EC2Instance -InstanceId i-1234567890abcdef0).Instances | Format-List BootMode, CurrentInstanceBootMode, InstanceType, ImageId 
					BootMode                : uefi
CurrentInstanceBootMode : uefi
InstanceType            : c5a.large
ImageId                 : ami-0265446f88eb4021b

在输出中,以下参数对启动模式进行了描述:

  • BootMode – 用于创建实例的 AMI 的启动模式。

  • CurrentInstanceBootMode – 用于在启动时启动实例的启动模式。


热门文章
更多>