Thursday, July 15, 2021

Unable to locate credentials - Ansible on AWS | NoCredentialsError: Unable to locate credentials

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: NoCredentialsError: Unable to locate credentials

fatal: [localhost]: FAILED! => {"boto3_version": "1.17.112", "botocore_version": "1.20.112", "changed": false, "msg": "Error in describe_security_groups: Unable to locate credentials"}

When ever you get this error, make sure you have right credentials setup in your EC2 instance or you have attached right IAM role with policy.

Option 1 

Create an IAM role and attach AmazonEC2FullAccess policy. and then attach this role to EC2 instance.

Option 2

sudo vi ~/.boto

add below three lines in the above file, replace the ?? with access key and secret key values.

[Credentials]
aws_access_key_id = ??
aws_secret_access_key = ??


No comments:

Post a Comment

DevOps Bootcamp Aug 2024 Schedule | DevOps & AWS Azure Cloud Coaching by Coach AK | DevOps and Cloud Computing Online Classes

  (Lot of new topics covered like GitHub Actions, Helm and Monitoring..) The DevOps requirements in the IT market space is expected to grow ...