# ec2\_snapshot module - how to get snapshot id of newly created snapshot?

**URL:** <https://forum.ansible.com/t/ec2-snapshot-module-how-to-get-snapshot-id-of-newly-created-snapshot/22019>\
**Category:** Ansible Project\
**Created:** [July 14, 2016, 6:53pm UTC](https://forum.ansible.com/t/ec2-snapshot-module-how-to-get-snapshot-id-of-newly-created-snapshot/22019 "2016-07-14T18:53:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jdelaporte](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jdelaporte/32/366_2.png) [@jdelaporte](https://forum.ansible.com/u/jdelaporte)\
**Post date:** [July 14, 2016, 6:53pm UTC](https://forum.ansible.com/t/ec2-snapshot-module-how-to-get-snapshot-id-of-newly-created-snapshot/22019/1 "2016-07-14T18:53:30Z")

</div>

I am using the ec2\_snapshot module to make a snapshot of a volume. In the next task, I want to use that new snapshot to create a new volume for a different server. How do I get the new snapshot volume id from the ec2\_snapshot module? It errored (unsupported parameter for module: register) when I tried to use register to catch output.

`

- name: snapshot current backup volume  
ec2\_snapshot:  
aws\_access\_key: “{{aws\_key}}”  
aws\_secret\_key: “{{aws\_secret}}”  
region: “{{aws\_region}}”  
state: present  
wait: yes  
wait\_timeout: 0 #0 means Never timeout(sec)  
description: “snapshot of xvdj from backup server taken {{ansible\_date\_time.iso8601}}”  
instance\_id: “i-a34c2437”  
device\_name: “/dev/xvdj”  
snapshot\_tags:  
frequency: random

`

---

<div class="post-metadata">

**Author:** ![Scott\_Sturdivant](https://avatars.discourse-cdn.com/v4/letter/s/f14d63/32.png) [@Scott\_Sturdivant](https://forum.ansible.com/u/Scott_Sturdivant)\
**Post date:** [July 14, 2016, 7:00pm UTC](https://forum.ansible.com/t/ec2-snapshot-module-how-to-get-snapshot-id-of-newly-created-snapshot/22019/2 "2016-07-14T19:00:45Z")

</div>

Sounds like an indentation issue. It should be at the same level as ‘ec2\_snapshot’, not the keys underneath it.

---

<div class="post-metadata">

**Author:** ![jdelaporte](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jdelaporte/32/366_2.png) [@jdelaporte](https://forum.ansible.com/u/jdelaporte)\
**Post date:** [July 14, 2016, 7:46pm UTC](https://forum.ansible.com/t/ec2-snapshot-module-how-to-get-snapshot-id-of-newly-created-snapshot/22019/3 "2016-07-14T19:46:02Z")

</div>

Oh, goodness. I can’t believe I missed that. It works now that I put the register statement at the correct indentation.

Thanks!
