ERROR in AWS image accessing

The app is using AWS for static media storage, app id is 13824 when we try to access any asset it is showing error


<Message>Access Denied</Message>




Can you help to fix it, please
cc: @ramzi
your help on an emergency basis @dmitrii.k

Hi @umer.siddiq, thanks for posting!

Our scaffold is configured to use S3 for media storage. Static assets are by default bundled into your Docker image and served by WhiteNoise.

ahh, just updated question, we are also using for media storage

@umer.siddiq, please refer to Getting Access Denied on S3 storage - #4 by dmitrii.k and see if that solves your problem.

Can you point out what I am missing? it seems not to solve my issue?

Dear @dmitrii.k we have AWS_DEFAULT_ACL = 'public-read' in Django already, but still getting the same issue, can you help to fix this?

Sure, @umer.siddiq, I’ll be happy to help. Could you please share a link to the file you’re trying to access?

thank you for your reply

Hi @umer.siddiq, happy to help!

This file doesn’t exist.

Hi, Thank you so much, can you make sure that AWS credentials exist for this app? can I get these variable values for my testing on local? the values which are present in my .env file, I am getting this error

An error occurred (InvalidAccessKeyId) when calling the PutObject operation: The AWS Access Key Id you provided does not exist in our records.

please help so we can fix this issue

Hi @umer.siddiq,

Yes, the credentials do exist in the production environment. In fact, they were last used today and you have files in your AWS S3, so you project must be/have been configured properly.

We do not provide key values for security reasons - they exist only in the production environment and are subject to change.

Usually, as you follow the BOTO S3 documentation, which in the case of our scaffold is a few lines changed in the configuration, it works as expected.

Locally, we encourage to use the standard file storage.

Let me check it, so for testing, you are suggesting to use prod env?

There isn’t anything to test really, your app is already configured with S3 and had been using it for over 300 days.

If it is using it from 300 days why it is not working? this issue is causing unnecessary delays in the final testing

@dmitrii.k any help here, please?

Hi @dmitrii.k appreciate your support as always maybe if we connect directly with @umer.siddiq

@umer.siddiq, I responded to you via DM yesterday, awaiting your reply

@ramzi, you need to make sure that the links you generate reflect your actual directory structure on AWS S3. AWS will by default always return NotAuthorized errors, even when files are not found.

Thanks @dmitrii.k for your usuall support. i will check what you recommended with @umer.siddiq and if we cant resolve it with him, we will check with an additonal backend engineer to fix that so we can move forward.


1 Like

It was again @dmitrii.k who supported us on the issue and pointed what going wrong. actually the issue was with Django, in our case image was being downloaded from a URL and then storing using a model which was actually disturbing the file structure. the following piece of code did the actual trick

location = Location(name=name.text, lat=lst_coordinate[1],long=lst_coordinate[0],category=category)
                    if image is not '':
                        with open(image,'rb') as f:
                            data =
              , ContentFile(data))
1 Like