stderr nAn error occurred InvalidClientTokenId when calling the PutMetricData operation The security token included in the request is invalid - Ansible

0 votes

I'm trying to create workers from my Ansible Master. This is my playbook:

- name: Provisioning Spot instaces
  ec2:
    assign_public_ip: no
    spot_price: "{{ ondemand4_price }}"
    spot_wait_timeout: 300
    assign_public_ip: no
    aws_access_key: "{{ assumed_role.sts_creds.access_key }}"
    aws_secret_key: "{{ assumed_role.sts_creds.secret_key }}"
    security_token: "{{ assumed_role.sts_creds.session_token }}"
    region: "{{ aws_region }}"
    image: "{{ image_instance }}"
    instance_type: "{{ large_instance }}"
    key_name: "{{ ssh_keyname }}"
    count: "{{ ninstances }}"
    state: present
    group_id: "{{ priv_sg }}"
    vpc_subnet_id: "{{ subnet_id }}"
    instance_profile_name: 'ML-Ansible'
    wait: true
    instance_tags:
      Name: Worker
    #delete_on_termination: yes
  register: ec2
  ignore_errors: True

I get the following error when I try to execute it. Please help!

"stderr": "\nAn error occurred (InvalidClientTokenId) when calling the PutMetricData operation: The security token included in the request is invalid.",
Apr 9, 2019 in Ansible by Himanshu
1,288 views

1 answer to this question.

0 votes
Was the credentials file configured before you created an AMI or after? If it was created before then you might want to try creating the credentials file after.

Let me know if this helps:)
answered Apr 9, 2019 by Anshul

Related Questions In Ansible

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

stopping different hosts from reading the same value when usign ansible in loop

Try using this. Create a new directory ...READ MORE

answered Jul 27, 2018 in Ansible by DareDev
• 6,890 points
702 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,036 views
+2 votes
1 answer
0 votes
1 answer
0 votes
1 answer

what is the difference between tags and delegate_to in ansible?

Hey @Rajendra, If you wish to perform ...READ MORE

answered Sep 24, 2019 in Ansible by Kalgi
• 52,350 points
1,919 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP