0

I am trying to create and attach an EBS volume on instance creation but I am getting error of no option :ebs , I am able to do this from AWS console so there should be some way with which I can create instance using a volume as disk

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')
4

1 に答える 1

0

キーを渡す必要があると思います。これは、ここ:block_device_mappingで概説されているように、ハッシュの配列である必要があります。例:

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'
)
于 2013-09-26T23:39:45.467 に答える