title: Error while executing playbook to start ec2 instance
body: <p>I have a playbook that starts an ec2 instance. But I keep getting the following error when I run it. </p>
  
  <pre><code>---
  
  - name: Create an ec2 instance
    hosts: localhost
    gather_facts: false
  
    vars:
        region: us-east-1
        instance_type: t2.micro
        ami: ami-01ac7d9c1179d7b74
        keypair: priyajdm
  
    tasks:
  
      - name: Create an ec2 instance
        ec2:
           key_name: "{{ keypair }}"
           group: launch-wizard-31
           instance_type: "{{ instance_type }}"
           image: "{{ ami }}"
           wait: true
           region: "{{ region }}"
           count: 1
           vpc_subnet_id: subnet-02f498e16fd56c277
           assign_public_ip: yes
        register: ec2
  </code></pre>
  
  <p>Error:
  An exception occurred during task execution. To see the full traceback, use -vvv. The error was: <Code>AuthFailure</Code>AWS was not able to validate the provided access credentialscb70bd1a-b7ec-41aa-895a-fabf9e0b6cfe
  fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-tmp-1553599571.08-120541135236553/AnsiballZ_ec2.py\", line 113, in \n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-tmp-1553599571.08-120541135236553/AnsiballZ_ec2.py\", line 105, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-tmp-1553599571.08-120541135236553/AnsiballZ_ec2.py\", line 48, in invoke_module\n    imp.load_module('<strong>main</strong>', mod, module, MOD_DESC)\n  File \"/tmp/ansible_ec2_payload_hXpgWw/<strong>main</strong>.py\", line 1702, in \n  File \"/tmp/ansible_ec2_payload_hXpgWw/<strong>main</strong>.py\", line 1686, in main\n  File \"/tmp/ansible_ec2_payload_hXpgWw/<strong>main</strong>.py\", line 989, in create_instances\n  File \"/home/ubuntu/.local/lib/python2.7/site-packages/boto/vpc/<strong>init</strong>.py\", line 1152, in get_all_subnets\n    return self.get_list('DescribeSubnets', params, [('item', Subnet)])\n  File \"/home/ubuntu/.local/lib/python2.7/site-packages/boto/connection.py\", line 1186, in get_list\n    raise self.ResponseError(response.status, response.reason, body)\nboto.exception.EC2ResponseError: EC2ResponseError: 401 Unauthorized\n\n<Code>AuthFailure</Code>AWS was not able to validate the provided access credentialscb70bd1a-b7ec-41aa-895a-fabf9e0b6cfe\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}</p>