# ec2\_ami creating a new AMI from EBS volume snapshot

**URL:** <https://forum.ansible.com/t/ec2-ami-creating-a-new-ami-from-ebs-volume-snapshot/20049>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [December 20, 2015, 2:54am UTC](https://forum.ansible.com/t/ec2-ami-creating-a-new-ami-from-ebs-volume-snapshot/20049 "2015-12-20T02:54:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![christopherlove68](https://avatars.discourse-cdn.com/v4/letter/c/58956e/32.png) [@christopherlove68](https://forum.ansible.com/u/christopherlove68)\
**Post date:** [December 20, 2015, 2:54am UTC](https://forum.ansible.com/t/ec2-ami-creating-a-new-ami-from-ebs-volume-snapshot/20049/1 "2015-12-20T02:54:52Z")

</div>

Hi all,

I have an existing manual process for creating an AMI from an EBS volume snapshot (note this is not creating an ami from an existing ec2 instance), which ultimately involves ec2-register (or ec2reg) from the AWS cli. For example:

> `$ ec2reg -a x86_64 -b '/dev/sda1=snap-xxxxx,28:true:gp2' -n amiName -d 'Description' --root-device=/dev/sda1 --virtualization-type hvm --region us-west-2`

I’ve now automated most of this in an Ansible playbook, including creating and writing the volume with the raw disk image created locally. While the ‘ec2\_ami’ module in 2.0 now supports the device\_mapping property I don’t see the ability to specify the architecture or virtualization type. It looks like the boto API would support this with the ec2.register\_image() method. Would this be a worthwhile extension to the ec2\_ami module (or has anyone already done this?)

Failing that, I suppose the alternative would be running ‘ec2reg’ locally in the context of the command module:

> `-name: AMI |Register AMI command:/opt/aws/bin/ec2reg-O <AWS key> -W <AWS secretkey> -n amiName -d 'Description' --root-device=/dev/sda1 --virtualization-type hvm --region us-west-2`

Anything else I might be missing?

Thanks in advance!

Chris

---

<div class="post-metadata">

**Author:** ![christopherlove68](https://avatars.discourse-cdn.com/v4/letter/c/58956e/32.png) [@christopherlove68](https://forum.ansible.com/u/christopherlove68)\
**Post date:** [December 21, 2015, 9:07pm UTC](https://forum.ansible.com/t/ec2-ami-creating-a-new-ami-from-ebs-volume-snapshot/20049/2 "2015-12-21T21:07:25Z")

</div>

Following up on my own question, it looks like Ansible PR #[2029](https://github.com/ansible/ansible-modules-core/pull/2029) will add this support.
