I have an AWS S3 bucket, I want a majority of my files to be accessible via a url (my images and video links, etc) - This is already being accomplished. I have other files that I DO NOT want to have accessible from a URL, these would be audio files (mp3, wav, flac etc.). I only want users to be able to access my audio files by a php script serving them to the browser. More or less, I dont want user to have access to these files by guessing the URL of my AWS bucket where the files reside.
I'm stumped. Can anyone point me in the right direction. Thanks.
You can make the files private and generate signed URLs to allow someone temporary access to the files: Share an Object with Others
Or you can set a policy to restrict people from accessing the files directly, only allowing them to access a file if it was linked from your website: Restricting Access to a Specific HTTP Referrer
Or you can serve those files by sending them through your PHP script, i.e. download the file to your PHP server and returning the file contents from there. In which case you can just make those files private in S3 or even move them to a separate bucket that is completely private. I don't recommend this method because it puts more load on your server.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With