title: S3 file availability and permits
body: <p>I want a file stored in an S3 bucket to be available only for users of a specific web application located on an EC2 instance.</p>
  
  <p>This is answered <a href="https://stackoverflow.com/questions/16028777/make-amazon-s3-files-available-only-to-logged-in-users">here</a>, but it leads to a deleted link...</p>
  
  <p>It is also explained <a href="http://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html#example-bucket-policies-use-case-4" rel="nofollow noreferrer">here</a>, but I don't know how to implement the solution...I'm supposed to include this code somewhere:</p>
  
  <pre><code>{
    "Version":"2012-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/*"]}
        }
      }
    ]
  }
  </code></pre>
  
  <p>How do I do this?</p>