[英]How can I mount ephemeral storage on a windows ec2 instance using boto?
I have an AMI with Windows Server 2008 as an EBS root device. 我有一个AMI与Windows Server 2008作为EBS根设备。 I can start it an instance using boto and remote desktop into it, but I cannot seem to get it mount its ephemeral storage.
我可以使用boto和远程桌面启动它的实例,但我似乎无法安装它的临时存储。 Is something wrong with my BlockDeviceMapping?
我的BlockDeviceMapping出了什么问题?
Here is my code: 这是我的代码:
import boto
from boto.ec2.connection import EC2Connection
conn = EC2Connection(mykey, mysecretkey)
bdm = boto.ec2.blockdevicemapping.BlockDeviceMapping({'/dev/xvdb':'ephemeral0'})
conn.run_instances(myami, key_name=mykeyname,security_groups=[mysecgroup],block_device_map=bdm)
When I run this code, an instance fires up and I can access, but I only see the root device mounted. 当我运行此代码时,一个实例启动并且我可以访问,但我只看到根设备已挂载。
I figured it out. 我想到了。 I had seen some examples which led me to believe that the block device map should be a string to string map, but it should actually be a string to BlockDeviceType map.
我见过一些例子让我相信块设备映射应该是字符串到字符串映射,但它实际上应该是BlockDeviceType映射的字符串。 Here is how I got it to work:
以下是我如何使用它:
from boto.ec2.connection import EC2Connection
from boto.ec2.blockdevicemapping import BlockDeviceType, BlockDeviceMapping
conn = EC2Connection(mykey, mysecretkey)
xvdb = BlockDeviceType()
xvdb.ephemeral_name='ephemeral0'
bdm = BlockDeviceMapping()
bdm['/dev/xvdb'] = xvdb
conn.run_instances(myami, key_name=mykeyname,security_groups=[mysecgroup],block_device_map=bdm)
When I logged in, I could see my ephemeral drive. 当我登录时,我可以看到我的短暂驾驶。 Not that it does not show up in the AWS management console as a block device.
并非它不会作为块设备显示在AWS管理控制台中。 You still only see your root device.
您仍然只能看到您的根设备。
Here is a code sample / forum question that helped me figure it out. 这是一个代码示例/论坛问题,帮助我弄明白。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.