# ec2\_vol create multiple devices

**URL:** <https://forum.ansible.com/t/ec2-vol-create-multiple-devices/18404>\
**Category:** Ansible Project\
**Created:** [June 4, 2015, 2:25pm UTC](https://forum.ansible.com/t/ec2-vol-create-multiple-devices/18404 "2015-06-04T14:25:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Igal\_Dahan](https://avatars.discourse-cdn.com/v4/letter/i/3bc359/32.png) [@Igal\_Dahan](https://forum.ansible.com/u/Igal_Dahan)\
**Post date:** [June 4, 2015, 2:25pm UTC](https://forum.ansible.com/t/ec2-vol-create-multiple-devices/18404/1 "2015-06-04T14:25:56Z")

</div>

Hi

i have trying to create several ec2 instances and 4 volumes for each instance, and i had trouble with it, here is part of it:

create several instances :

- name: Launch instances  
local\_action:  
module: ec2  
image: “{{ image }}”  
instance\_type: “{{ instance\_type }}”  
keypair: “{{ keypair }}”  
instance\_tags: ‘{ “Name”:“{{ hostname }}” , “Group”:“nginx\_backend” }’  
region: “{{ region }}”  
group: “{{ group }}”  
zone: “{{ zone }}”  
wait: “true”  
spot\_wait\_timeout: 300

count: “{{count}}”  
register: ec2

and now upon that create for each instance several volumes

- name: Create Volume  
local\_action:  
module: ec2\_vol  
instance: “{{ item.id }}”  
device\_name: “/dev/xvd{{ item.1 }}”

region: “{{ region }}”  
zone: “{{ zone }}”  
volume\_size: “{{volume\_size}}”  
volume\_type: “gp2”  
with\_items: ec2.instances  
register: ec2\_vol

so i have tried to add with\_together …

with\_together:

- [‘d’, ‘e’, ‘f’ , ‘g’]

and seems that with\_items and with\_together are not working together , i have tried with\_nested and other issue as loop, nothing work.

who can help me here?

i will be very appreciated…🙂

Igal
