Search code examples
djangoamazon-ec2amazon-s3access-denied

EC2 can't access S3 file


I have a very strange error on my website. I keep getting this Django error:

Attempted access to 'http:/***.s3.amazonaws.com/media/banderas/Cambodia-flag.png' denied.

But when I access that file directly from my admin panel, it works fine. It fails only when the main page wants to access that file.

Any ideas what can be wrong?


Solution

  • What permissions are set? If you're accessing the Url for the image whilst logged in via the admin panel then you have full permissions to view anything/delete anything etc.

    If the image url is used in a web site you need to make sure that the S3 object has an "Everyone" View/Download permission set. What happens if you access the image url without being logged in to the admin panel - just put it into the browser address bar?