没有任何附加卷的EC2实例? [英] EC2 Instance without any attached Volume?

查看:138
本文介绍了没有任何附加卷的EC2实例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以有没有任何卷(根设备或附加卷)的实例?
可以说instance_id为[i-120cd3fe,i-23e46634]
AWS中是否可能存在没有任何附加卷的任何实例?

Is it Possible to have instances without any volume(root-device or attached volume)?
Lets say the instance_ids are [i-120cd3fe,i-23e46634]
Is it possible that any Instances are present without any attached volume in AWS?

    conn=get_ec2_connection(region=region)  
    instances = conn.get_only_instances(instance_ids=instance_ids)   
    volumes_list=[]
    for instance in instances:  
       dev_mappings = instance.block_device_mapping  
       for block_device in dev_mappings.keys():  
           volume_id = dev_mappings[block_device].volume_id
           volumes_list.append(volume_id)

    print volumes_list  

输出应为:[无]

推荐答案

没有根卷就不能拥有实例.因此,块设备映射中将始终至少列出一个卷.

You can't have an instance without a root volume. So there will always be at least one volume listed in the block device mapping.

我错了.自从我启动实例存储支持的AMI以来已经很久了,以至于我什至忘记了它们的存在.支持实例存储的AMI不会在块设备映射中描述其根卷,因此,如果您有这样的实例并且没有附加EBS卷,则块设备映射将为空.

I'm wrong about that. It has been so long since I launched an instance store backed AMI that I kind of forgot they even existed. An instance store backed AMI does not describe its root volume in the block device mapping so if you have such an instance and have no EBS volumes attached the block device mapping would be empty.

对于基于EBS的实例,即使对于已停止的实例,块设备映射也将始终(至少)包含根卷,除非您已将该卷与实例明确分离.

For an EBS-based instance the block device mapping will always contain the root volume (at least) even for stopped instances UNLESS you have explicitly detached that volume from the instance.

这篇关于没有任何附加卷的EC2实例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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