如何使用boto3指定核心操作系统EC2实例的根卷大小? [英] How to specify root volume size of core-os ec2 instance using boto3?

查看:514
本文介绍了如何使用boto3指定核心操作系统EC2实例的根卷大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法从<一弄清楚href="http://boto3.readthedocs.org/en/latest/reference/services/ec2.html#EC2.ServiceResource.create_instances"相对=nofollow>文档和源$ C ​​$ C如何定义根设备的尺寸。

I cannot figure out from documentation and source code how to define size of the root device.

您可以使用BlockDeviceMappings部分,在那里你可以声明它们的大小指定N个附加块设备。但是没有办法设置根卷的大小。因此,它总是与大小为8GB的根卷这是默认值创建一个实例。

You can specify N additional block devices using BlockDeviceMappings section where you can declare their sizes. But there is no way to set size of the root volume. So it always create an instance with root volume of size 8GB which is the default value.

推荐答案

请参阅<一href="https://stackoverflow.com/questions/13585857/how-to-launch-ec2-instance-with-boto-specifying-size-of-ebs">Stackoverflow:如何启动EC2实例与宝途,指定EBS的大小?

此外,这里有一个方法,从 AWS命令行界面(CLI)做到这一点:

Also, here's a way to do it from the AWS Command-Line Interface (CLI):

aws ec2 run-instances --image-id ami-xxxxxxxx --instance-type m1.xlarge --block-device-mappings '{"DeviceName": "/dev/sda1","Ebs" : { "VolumeSize" : 50 }}'

这篇关于如何使用boto3指定核心操作系统EC2实例的根卷大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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