Hi ,
I am trying to create EC2 instances using ansible module ec2 and the root volume gets created as “standard”. I would like that to be “gp2”
Below is the play that I am using
name: Launch the new EC2 Instance
ec2:
group: ‘{{ security_group }}’
instance_type: ‘{{ instance_type}}’
image: ‘{{ image }}’
wait: true
region: ‘{{ region }}’
vpc_subnet_id: ‘{{ vpc_subnet_id }}’
keypair: ‘{{ keypair }}’
count: 20
volumes:
device_name: /dev/sda1
volume_type: gp2
volume_size: 10
register: ec2
I can create gp2 volumes using ec2_vol and attach to EC2, however I would like my root volume to be gp2. I can create EC2 root volume using AWS console from the same AMI.
Is it possible to use gp2 for root volumes ?
Thanks,
Abey
igorc
October 28, 2015, 8:22am
2
Probably it is not supported and I can't see any of examples in the docs referring to /dev/sda1 in the volumes section.
What you can do though is go to your ec2 console and set gp2 type as default when launching new instances.
viper233
(Stephen Granger)
October 28, 2015, 4:04pm
3
Would this depend on the AMI being used having a root ssd volume?
I’m unsure of this and would be happily corrected.
Hi all,
Thanks for reading my question. I have successfully created gp2 root volume by changing “volume_type: gp2” to “device_type: gp2” . (Not sure why it works. manual says that device_type is deprecated)
The below yaml works
name: Launch the new EC2 Instance
ec2:
group: ‘{{ security_group }}’
instance_type: ‘{{ instance_type}}’
image: ‘{{ image }}’
wait: true
region: ‘{{ region }}’
vpc_subnet_id: ‘{{ vpc_subnet_id }}’
keypair: ‘{{ keypair }}’
count: ‘{{count}}’
volumes:
device_name: /dev/sda1
device_type: gp2
volume_size: 8
register: ec2
Regards,
Abey