ec2_ami "msg": "InvalidParameterValue: Value (['i-092axxxxxxxxxxd64']) for parameter instance is invalid. Expected: 'i-...'."

116 views
Skip to first unread message

sreenivas narayan

unread,
Apr 18, 2017, 5:55:13 AM4/18/17
to Ansible Project
Hi Guys,

I am using ec2 ami to create image of instance and getting error as above. Please help.

ansible version: 2.2.1.0


- name: Create ami from the image
  local_action:
    module: ec2_ami
    aws_access_key: "{{ xxxxxxxxxxxxxxxxxxxxx}}"
    aws_secret_key: "{{ yyyyyyyyyyyyyyyyyyyyyy}}"
    instance_id: "{{ new_instanceid }}"
    region: 'us-east-1'
    wait: yes
    name: xxxxxxx
      Name: newtest
      Service: TestService
  register: image

----------------
fatal: [127.0.0.1 -> localhost]: FAILED! => {
    "changed": false,
    "failed": true,
    "invocation": {
        "module_args": {
            "aws_access_key": "xxxxxxxxxxxxxxxxxxxxxx",
            "aws_secret_key": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "delete_snapshot": false,
            "description": "",
            "device_mapping": null,
            "ec2_url": null,
            "image_id": null,
            "instance_id": "['i-xxxxxxxxxxxxxxxxxxx']",
            "launch_permissions": null,
            "name": "xxx-AMI",
            "no_reboot": false,
            "profile": null,
            "region": "us-east-1",
            "security_token": null,
            "state": "present",
            "tags": {
                "Name": "newtest",
                "Service": "TestService"
            },
            "validate_certs": true,
            "wait": true,
            "wait_timeout": "900"
        },
        "module_name": "ec2_ami"
    },
    "msg": "InvalidParameterValue: Value (['i-xxxxxxxxxxxxxxxx']) for parameter instance is invalid. Expected: 'i-...'."







--------------------

sreenivas narayan

unread,
Apr 18, 2017, 6:48:13 AM4/18/17
to Ansible Project
got it :)

 instance_id: "{{ new_instanceid[0] }}"
Reply all
Reply to author
Forward
0 new messages