有没有办法从实例获取平台和操作系统 [英] Is there any way to get the platform and OS from the instances

查看:102
本文介绍了有没有办法从实例获取平台和操作系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从我的AWS EC2实例中获取一些信息。我想知道是否有拉信息的方法,例如:

I am trying get some information from my AWS EC2 instances. I will like to know if there is a way to pull information like:

| Platform  | Version        |
|-----------|---------------:|
| CentOS    |  6.0 or 7.0    |
| Ubuntu    | 10.04 or 12.04 |
| Windows   |                |

我想知道使用SDK能否做到这一点。我尝试使用Python SDK Boto3,但没有结果。

I will like to know if this is possible using the SDK. I tried with Python SDK Boto3 but no results.

推荐答案

除非您已将该信息存储为标记。 AWS开发工具包和CLI可以帮助您获取虚拟机管理程序级别可用的信息。

It is not possible with SDK or CLI unless you have stored that information as tags. AWS SDK and CLI can help you get information that are available at the hypervisor level. But what you are asking is available inside the VM not at hypervisor.

虽然下面的CLI命令可以为您提供一定的帮助,但是并不能保证您将获得该平台

While the following CLI command can help you a bit, but there is no guarantee you will get the platform information for all instances.

aws ec2 describe-instances --query 'Reservations[*].Instances[*].[InstanceId,Platform]' --output text

i-07843115f653771c8 windows
i-e34364c87d4cebd12 None
i-0493b6a67b31df018 None

这篇关于有没有办法从实例获取平台和操作系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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