Nate
Nate

Reputation: 59

Cannot find AWS_KEY_ID to connect to Boto3

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?

Upvotes: 0

Views: 137

Answers (1)

A Simple Programmer
A Simple Programmer

Reputation: 644

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

Upvotes: 2

Related Questions