如何使用 AWS CLI 查找 EC2 实例的操作系统 [英] How to find OS of an EC2 instance using AWS CLI

查看:18
本文介绍了如何使用 AWS CLI 查找 EC2 实例的操作系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 AWS CLI 找出在 EC2 实例上运行的操作系统.

How can you find out the OS running on an EC2 instance using AWS CLI.

ec2 describe-instance 命令吐出很多信息,但没有任何指示操作系统的信息.

The ec2 describe-instance command spits out a lot of information , but there is nothing indicating the OS .

我还在特定图像上尝试了 ec2 describe-images.同样,似乎没有任何操作系统迹象.

I also tried ec2 describe-images on a specific image. Again, there doesn't seem to be any indication of OS.

帮助...?

推荐答案

试试这个命令:

aws ec2 describe-images --image-ids $(aws ec2 describe-instances --instance-ids i-xxxxxxxxxxxxx --query 'Reservations[0].Instances[0].ImageId' --output text) --query 'Images[0].Name'

$() 部分使用 InstanceId 获取 ImageId.

$() part gets the ImageId using InstanceId.

这篇关于如何使用 AWS CLI 查找 EC2 实例的操作系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆