如何检索AMI平台? [英] How to retrieve AMI platform?

查看:105
本文介绍了如何检索AMI平台?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检索实例/AMI的平台(Windows,Linux/Unix)值? AWS控制台显示AMI的平台价值.

How do I retrieve platform (windows, Linux/Unix) value for an instance/AMI? AWS Console shows the platform value for an AMI.

我已经将 dict 属性转储到了AMI对象上,但是它没有显示正确的平台?

I have dumped the dict property on the AMI object but it does not show the correct platform?

推荐答案

Image对象的一个​​属性称为platform.如果映像是Windows映像,则此属性的值为windows;如果是Linux,则此属性的值为None.例如:

There is an attribute of the Image object called platform. This attribute will have a value of windows if the image is a Windows image or None if it is Linux. For example:

import boto.ec2
c = boto.ec2.connect_to_region('us-east-1')
images = c.get_all_images(owners='self')
for image in images:
    if image.platform == 'windows':
        print('Image {} is a Windows Image'.format(image.id))
    else:
        print('Image {} is a Linux Image'.format(image.id))

这篇关于如何检索AMI平台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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