如何在AWS EC2运行实例期间设置块设备映射? [英] how to set block-device-mappings during aws ec2 run-instances?

查看:203
本文介绍了如何在AWS EC2运行实例期间设置块设备映射?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

sof

如何在AWS EC2运行实例期间设置块设备映射?

how to set block-device-mappings during aws ec2 run-instances?

我是awscli的新手.

I am new to awscli.

我将其安装到python env中.

I pip installed it into my python env.

我知道这个示例可以正常工作:

I got this example to work ok:

aws ec2 run-instances --image-id ami-d2c924b2 --instance-type m4.large

如何增强上述shell命令,以使我有更多的磁盘空间启动?

How to enhance the above shell command so I launch with more disk space?

我尝试了这种语法,但失败了:

I tried this syntax and it failed:

aws ec2 run-instances --image-id ami-d2c924b2 --instance-type m4.large --block-device-mappings {"DeviceName":"/dev/sda1","Ebs":{"VolumeSize":100}}

推荐答案

这是在不将代码移动到单独的JSON的情况下工作的方式:

Here is how it works without moving the code to separate JSON:

aws ec2 run-instances \
    --image-id ami-d2c924b2 \
    --instance-type m4.large \
    --block-device-mappings 'DeviceName=/dev/sda1,Ebs={VolumeSize=32}'

这篇关于如何在AWS EC2运行实例期间设置块设备映射?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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