"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
24 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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,670 points
25 views
+13 votes
2 answers
0 votes
1 answer
0 votes
1 answer
+1 vote
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.