ERROR Inventory script inventory ec2 py had an execution error ERROR Authentication error retrieving ec2 inventory

0 votes

Hi Guys,

I am trying to run a python script using Ansible. This script gives the dynamic IP of my EC2 instance. But I am getting the below output.

Output: ERROR: Inventory script (inventory/ec2.py) had an execution error: ERROR: "Authentication error retrieving ec2 inventory. - AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment vars found but may not be correct - Boto configs found at '~/.boto, ~/.aws/credentials', but the credentials contained may not be correct", while: getting EC2 instances
Aug 21, 2020 in Ansible by akhtar
• 38,260 points
1,276 views

1 answer to this question.

0 votes

Hi@akhtar,

You have to generate the AWS credentials for AWS_PROFILE. This file has values for below environment variables in ~/.aws/credentials.

  1. aws_access_key_id

  2. aws_secret_access_key

  3. aws_session_token.

However, if you look in the ec2.py, it expects the variable values. So you have to set the variable values.

answered Aug 21, 2020 by MD
• 95,460 points

Related Questions In Ansible

0 votes
0 answers
+1 vote
1 answer
0 votes
1 answer
0 votes
1 answer

Is it possible to run an Ansible Playbook in python script?

Hey @Cerci, Of course its possible. You ...READ MORE

answered Jan 17, 2019 in Ansible by Nicolas
15,666 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,034 views
+2 votes
1 answer
0 votes
1 answer

How to launch an EC2 instance using Ansible Playbook?

Hi@akhtar, Ansible has one module named ec2. This ...READ MORE

answered Aug 12, 2020 in Ansible by MD
• 95,460 points
2,053 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