Is there any way to get the platform and OS from t

2019-02-28 05:14发布

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   |                |

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

1条回答
Evening l夕情丶
2楼-- · 2019-02-28 05:52

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.

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
查看更多
登录 后发表回答