实例类型:(t2.micro,t2.small,c4.large ...)这里列出的那些:http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html
我想通过boto3访问这些列表.就像是:
conn.get_all_instance_types()
Run Code Online (Sandbox Code Playgroud)
甚至
conn.describe_instance_types()['InstanceTypes'][0]['Name']
Run Code Online (Sandbox Code Playgroud)
在这个奇怪的api中,一切看起来都像.
我查看了客户端和ServiceResource的文档,但我找不到任何似乎接近的东西.我甚至没有找到一个hacky解决方案,列出了碰巧代表所有实例类型的其他内容.
谁有更多的boto3经验?
在 boto3 中有一个函数:
ec2.instances.filter()
Run Code Online (Sandbox Code Playgroud)
文档:http : //boto3.readthedocs.org/en/latest/reference/services/ec2.html#instance
假设它返回一个我希望的列表(ec2.Instance)...
当我尝试打印退货时,我得到了这个:
ec2.instancesCollection(ec2.ServiceResource(), ec2.Instance)
Run Code Online (Sandbox Code Playgroud)
我尝试搜索任何提及 ec2.instanceCollection 的内容,但我发现的唯一内容与 ruby 类似。
我想遍历这个 instanceCollection 以便我可以看到它有多大,存在哪些机器以及类似的东西。问题是我不知道它是如何工作的,并且当它为空时迭代根本不起作用(它会引发错误)
使用python api for azure,我想得到我的一台机器的状态.
我无法在任何地方找到这些信息.
有人知道吗?
环顾四周后,我发现了这个:
get_with_instance_view(resource_group_name, vm_name)
Run Code Online (Sandbox Code Playgroud)