I need to download a file from aws bucket ( name known ) and object name know. But access key id and secret key are not known.
import boto3
import pandas as pd
s3 = boto3.client('s3')
s3 = boto3.resource(service_name='s3')
s3.Bucket('yz').download_file(Key='keh.docx', Filename='keh.docx')
Getting the Following error
NoCredentialsError: Unable to locate credentials
Is there any way that we can download a file without secret key and access id?
2
Answers
Yes, if the object is public. Then you don’t need any credentials. Also you can download objects with credentials if you have S3 pre-signed url for the object.
In all other cases, credentials are required in one form or the other.
An example from the boto3 documentation
If the file is in a public bucket, you can only use the
request
package.