Cannot find AWS_KEY_ID to connect to Boto3

Question:

I am just getting started using Boto3 to connect to AWS, and I cannot get it to work.

This is my code:

#client

client = boto3.client('s3')

list_bucket=client.list_buckets()

print(list_bucket)

This is the error message I receive:

botocore.exceptions.NoCredentialsError: Unable to locate credentials

I tried to set up CLI access through following tutorials, and I created a file called credentials within my .aws/ folder that looks like this (with my actual keys instead of blanks):

[default]
aws_access_key_id = ________________
aws_secret_access_key = ____________________________

From my understanding, boto3 should automatically find the aws_access_key_id from my credentials file in my .aws/ folder, but that doesn’t appear to be working.

Does anyone see where I went wrong?

Asked By: Nate

||

Answers:

The solution was to download AWS cli and use the aws configure command to put the config file in the correct location

Answered By: A Simple Programmer