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