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