# ec2 ami : "msg": "AMI not updated" while retrieving  new ami id

**URL:** <https://forum.ansible.com/t/ec2-ami-msg-ami-not-updated-while-retrieving-new-ami-id/24300>\
**Category:** Ansible Project\
**Created:** [April 25, 2017, 5:27am UTC](https://forum.ansible.com/t/ec2-ami-msg-ami-not-updated-while-retrieving-new-ami-id/24300 "2017-04-25T05:27:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sreenivas\_narayan](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@sreenivas\_narayan](https://forum.ansible.com/u/sreenivas_narayan)\
**Post date:** [April 25, 2017, 5:27am UTC](https://forum.ansible.com/t/ec2-ami-msg-ami-not-updated-while-retrieving-new-ami-id/24300/1 "2017-04-25T05:27:36Z")

</div>

Hello Guys,

I am using a playbook to create ami and trying to fetch the newely created ami id. But the debug is getting ‘msg": “AMI not updated”’’ Please help

---

<div class="post-metadata">

**Author:** ![Shmulik\_Alfandari](https://avatars.discourse-cdn.com/v4/letter/s/58f4c7/32.png) [@Shmulik\_Alfandari](https://forum.ansible.com/u/Shmulik_Alfandari)\
**Post date:** [April 25, 2017, 8:45am UTC](https://forum.ansible.com/t/ec2-ami-msg-ami-not-updated-while-retrieving-new-ami-id/24300/2 "2017-04-25T08:45:29Z")

</div>

Hi,

Please do as follows:

```auto
# Create AMI
    - name: Create AMI
      local_action:
        module: ec2_ami
        instance_id: "{{ item.id }}"
        wait: yes
        wait_timeout: 3600
        aws_access_key: "{{ AWSAccessKey }}"
        aws_secret_key: "{{ AWSSecretKey }}"
        region: "{{ region }}"
        name: Test
        description: "Test"
        launch_permissions:
          user_ids: ['XXXXXXXXXXXX']
        device_mapping:
          - device_name: /dev/sda1
            size: 50
            volume_type: gp2
      with_items: "{{ ec2.instances }}"
      **register: image**

    **- name: Print AMI ID**
 **debug: msg="{{ image.results[0].image_id }}"**

```

```auto

```

```auto
**Thanks,**

```

```auto
**Shmulik.**

```

בתאריך יום שלישי, 25 באפריל 2017 בשעה 08:27:37 UTC+3, מאת sreenivas narayan:
