Apologies if this has already been asked previously - I couldn't seem to find the relevant information I required.
I'm having issues running a playbook to launch a EC2 instance in AWS China. The same playbook works in non-China AWS accounts.
TASK [Launch instance] *********************************************************
ESTABLISH LOCAL CONNECTION FOR USER: ubuntu
127.0.0.1 EXEC (<REDACTED>)
127.0.0.1 EXEC LANG=C LC_MESSAGES=C LC_CTYPE=C <REDACTED> > /dev/null 2>&1
An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
File "/Users/Etherdaemon/.ansible/tmp/ansible-tmp-1445294739.44-143915179278919/ec2", line 3429, in <module>
File "/Users/Etherdaemon/.ansible/tmp/ansible-tmp-1445294739.44-143915179278919/ec2", line 1392, in main
(tagged_instances, instance_dict_array, new_instance_ids, changed) = enforce_count(module, ec2, vpc)
File "/Users/Etherdaemon/.ansible/tmp/ansible-tmp-1445294739.44-143915179278919/ec2", line 771, in enforce_count
reservations, instances = find_running_instances_by_count_tag(module, ec2, count_tag, zone)
File "/Users/Etherdaemon/.ansible/tmp/ansible-tmp-1445294739.44-143915179278919/ec2", line 558, in find_running_instances_by_count_tag
reservations = get_reservations(module, ec2, tags=count_tag, state="running", zone=zone)
File "/Users/Etherdaemon/.ansible/tmp/ansible-tmp-1445294739.44-143915179278919/ec2", line 617, in get_reservations
results = ec2.get_all_instances(filters=filters)
File "/usr/local/lib/python2.7/site-packages/boto/ec2/connection.py", line 585, in get_all_instances
File "/usr/local/lib/python2.7/site-packages/boto/ec2/connection.py", line 681, in get_all_reservations
[('item', Reservation)], verb='POST')
File "/usr/local/lib/python2.7/site-packages/boto/connection.py", line 1186, in get_list
raise self.ResponseError(response.status, response.reason, body)
boto.exception.EC2ResponseError: EC2ResponseError: 401 Unauthorized
<?xml version="1.0" encoding="UTF-8"?>
<Response><Errors><Error><Code>AuthFailure</Code><Message>AWS was not able to validate the provided access credentials</Message></Error></Errors><RequestID>88e083e5-bdcf-4bf0-95ba-740ceb5ec790</RequestID></Response>
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "parsed": false}
- name: Create an All In One Environment
- "../variable_files/{{ env }}_vars.yml"
key_name: "{{ key_name }}"
group: "{{ security_group }}"
instance_type: "{{ instance_type }}"
vpc_subnet_id: "{{ subnet_id }}"
Name: "{{ role }}{{ '%02d'|format(instance_count|int) }}.{{ env }}.aws-{{ region_shortname }}.{{ tld_name_internal }}"
Environment: "{{ environment_name }}"
exact_count: "{{ instance_count }}"
Environment: "{{ environment_name }}"
instance_profile_name: "{{ game }}_{{ env }}_ec2_role"
user_data: "{{ lookup('file', 'files/userdata.txt') }}"
- name: Add new instance to host group
add_host: hostname={{ item.public_ip }} groupname="{{ environment_name }}"
with_items: ec2.instances
- name: Wait for SSH to come up
wait_for: host={{ item.public_dns_name }} port=22 delay=60 timeout=320 state=started
with_items: ec2.instances