By arnaud9
I build a s3 space and can upload files in this one with success. I meet a problem when I try to browse files stored on my space. Here is the client I use :
session = boto3.session.Session()
client = session.client('s3', region_name='fra1',
endpoint_url=settings.AWS_S3_ENDPOINT_URL,
aws_access_key_id=settings.AWS_ACCESS_KEY_ID,
aws_secret_access_key=settings.AWS_SECRET_ACCESS_KEY
)
This part is ok because it’s exactly the same for uploading. Error happens at the following line :
resp = client.list_objects(Bucket=settings.AWS_STORAGE_BUCKET_NAME)
I got this response :
An error occurred (NoSuchKey) when calling the ListObjects operation: Unknown
And I can’t explain why it doesn’t recognize my key. I tried with a wrong key like Bucket=“helloworld” and got exactly the same error. Otherwise I’m sure my settings.AWS_STORAGE_BUCKET_NAME is the correct one because I can seet it when I go on my endpoint_url
<ListBucketResult xmlns=“http://s3.amazonaws.com/doc/2006-03-01/”> <Name>[MY_BUCKET_NAME]</Name> <Prefix/> <MaxKeys>1000</MaxKeys> <IsTruncated>false</IsTruncated>
Thank you for helping :)
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Tried to resolve it for hours. It turns out you have to remove your bucket name from endpoint url. And then it works.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.