. Advertisement .
..3..
. Advertisement .
..4..
I get the error Boto3 Error: botocore.exceptions.NoCredentialsError: Unable to locate credentials when trying the following code
s3 = boto3.resource('s3')
bucket_name = "python-sdk-sample-%s" % uuid.uuid4()
print("Creating new bucket with name:", bucket_name)
s3.create_bucket(Bucket=bucket_name)
This is output from boto3.set_stream_logger(‘botocore’, level=’DEBUG’)
2022-04-24 16:21:28,761 botocore.credentials [DEBUG] Skipping environment variable credential check because profile name was explicitly set.
2022-04-24 16:21:28,761 botocore.credentials [DEBUG] Looking for credentials via: env
2022-04-24 16:21:28,773 botocore.credentials [DEBUG] Looking for credentials via: shared-credentials-file
2022-04-24 16:21:28,774 botocore.credentials [DEBUG] Looking for credentials via: config-file
2022-04-24 16:21:28,774 botocore.credentials [DEBUG] Looking for credentials via: ec2-credentials-file
2022-04-24 16:21:28,774 botocore.credentials [DEBUG] Looking for credentials via: boto-config
2022-04-24 16:21:28,774 botocore.credentials [DEBUG] Looking for credentials via: iam-role
I think my settings might be wrong, I saved my credential file in C:\Users\myname\.aws\credentials
I’m not sure how to fix it? Give me some advice.
I also think you are setting wrong, please check:
1) ~/.aws/credentials file
2) Python script
Make sure it’s like that, it will work