set up my AWS credentials and configure boto3, but I’m facing an issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
Hi everyone,
I’m working on a project where I need to upload files from my local machine to an AWS S3 bucket using the boto3 library in Python. I’ve followed the official documentation to set up my AWS credentials and configure boto3, but I’m facing an issue when trying to upload a file.
I am using :
import boto3
s3 = boto3.client('s3')
bucket_name = 'my-bucket'
file_path = 'path/to/my/file.txt'
s3.upload_file(file_path, bucket_name, 'file.txt')
I’m encountering the following error:
botocore.exceptions.NoCredentialsError: Unable to locate credentials.
I’ve already set up my AWS Access Key ID and Secret Access Key in the ~/.aws/credentials file, but I’m still getting the same error message.
Has anyone encountered this issue before, or does anyone have suggestions on how to resolve it?
Thanks in advance!
Nima
![](/skins/images/97567C72181EBE789E1F0FD869E4C89B/responsive_peak/images/icon_anonymous_message.png)
![](/skins/images/97567C72181EBE789E1F0FD869E4C89B/responsive_peak/images/icon_anonymous_message.png)