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

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

Hi,

Please do as follows:

# 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 }}"**

**Thanks,**
**Shmulik.**

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