我正在尝试在实例创建时创建并附加EBS卷,但是我收到了无选项的错误:ebs,我可以从AWS控制台执行此操作,因此应该有一些方法可以使用a创建实例卷为磁盘
instance = ec2.instances.create(:image_id => ami-aa***,
:key_name => ec2.key_pairs["Dev-node"].name,
:ebs => {
:volume_size => 20, #size in GBs
:delete_on_termination => true
},
:instance_type => 't1.micro')
答案 0 :(得分:0)
我相信您需要传递:block_device_mapping
密钥,该密钥应该是概括为here的哈希数组,例如:
instance = ec2.instances.create(
:image_id => "ami-aa***",
:key_name => ec2.key_pairs["Dev-node"].name,
:block_device_mapping => [
{
"DeviceName" => "/dev/sdf",
"Ebs.VolumeSize" => 20,
"Ebs.DeleteOnTermination" => true
}
],
:instance_type => 't1.micro'
)