Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent direct download of audio files from amazon s3

I have audio files stored at Amazon S3 which are accessed from a web based music player app and also from mobile apps. Even non signed in users should be able to access the music. However i dont want people to use the link to download the content. Can this be accomplished in s3 ?

Thank You

like image 635
raza.sayed Avatar asked Feb 25 '13 13:02

raza.sayed


People also ask

How do you stop people from downloading S3 videos?

Just disable public access to your bucket. Develop your web site to it only streams video content from an Amazon S3 bucket and does not support downloading the video.

How do I stop an mp3 from downloading?

The best way to protect your mp3 audio files from downloading is by setting up a reverse proxy. A reverse proxy server can be customized to a great extent to set access control to your media to protect mp3 audio files from downloading (or audio file copying).

Which features can be used to restrict access to Amazon S3 data?

You can configure any access point to accept requests only from a virtual private cloud (VPC) to restrict Amazon S3 data access to a private network. You can also configure custom block public access settings for each access point.


1 Answers

You can restrict access based on the HTTP referrer. It's not bulletproof (Referrer can be spoofed) but it will stop casual downloads.

You use a bucket policy to restrict the possible values for Referrer.

There's an example on this page (scroll down a bit) http://docs.aws.amazon.com/AmazonS3/latest/dev/AccessPolicyLanguage_UseCases_s3_a.html

Here's their example:

{
  "Version":"2008-10-17",
  "Id":"http referer policy example",
  "Statement":[
    {
      "Sid":"Allow get requests originated from www.example.com and example.com",
      "Effect":"Allow",
      "Principal":"*",
      "Action":"s3:GetObject",
      "Resource":"arn:aws:s3:::examplebucket/*",
      "Condition":{
        "StringLike":{
          "aws:Referer":[
            "http://www.example.com/*",
            "http://example.com/*"
          ]
        }
      }
    }
  ]
}

You could also do signed URLs that expire - that would stop people from LINKING to your content from other site.

like image 96
secretmike Avatar answered Oct 03 '22 09:10

secretmike