[Fixed] Acces private data in S3 from angular front end

Issue

I’m working on a marketplace.
My back end upload many ebooks, previews and screenshots in a private S3.

When i login in the user dashboard, the back end send me metadata about ebook i uploaded.
In the ebook, I have for example the screenshot url.
When I want to display the screenshot using the url, I have access denied.

Another part of the dashboard is public, so i can display all ebooks cover like amazon for example, so we will have many access.

How could i use aws sdk or another methods to display screenshots, covers, using urls sent by the back end ? How could I tell s3 to allow the my angular front end to access files in the s3 ?

PS: I can’t use presigned url, because we will have have million of access in production per day.

Solution

can’t use presigned url

If you can’t use pre-signed URLs, then you have only two options to access S3 images/files from the front end:

  • make them all public, maybe in separate bucket or prefix.
  • setup CloudFront distribution to server the static files from S3. This way your bucket or its objects don’t have to be public.

Leave a Reply

(*) Required, Your email will not be published