botocore.exceptions.ClientError: An error occurred (AuthFailure)

1.7k views Asked by At

Not sure what's going on here... I am having this error when doing a simple describe-instance using the boto3 client.

Error: botocore.exceptions.ClientError: An error occurred (AuthFailure) when calling the DescribeInstances operation: AWS was not able to validate the provided access credentials

Code snippet:

  def get_ec2_client(aws_access_key_id, aws_secret_access_key, region_name):

    return boto3.client(
            'ec2',
            aws_access_key_id=aws_access_key_id,
            aws_secret_access_key=aws_secret_access_key,
            region_name=region_name
        )

  instances=client.describe_instances()

I ran this in debug so I am sure that the creds are correct. I also use the same creds with the cli and it worked, so it is a bit confused what's going on. This was working up till yesterday so I checked the boto3 and botocore modules updates. They are updated almost daily but I don't see any breaking changes in the latest updates.

I've been at this for some time and still couldn't find the issue. Any idea anyone?

Since I am facing this issue today I am using: boto3 1.15.11
botocore 1.18.11

0

There are 0 answers