"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 8 in Ansible by Himanshu
126 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 8 by Anshul

Related Questions In Ansible

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,810 points
38 views
+13 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 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
180 views
0 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 in Ansible by Kalgi
• 41,660 points
40 views