Reputation: 181
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.
This is answered here, but it leads to a deleted link...
It is also explained here, but I don't know how to implement the solution...I'm supposed to include this code somewhere:
{
"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/*"]}
}
}
]
}
How do I do this?
Upvotes: 0
Views: 40
Reputation: 11808
The above code of your's is aws security policy.....
You need to do the following things:
Step1: Create a IAM user from AWS Dashboard -> Users -> Create New Users.
Step2: Create a policy for your bucket from AWS Dashboard -> Policies -> Get Started -> Create Policy.
Step3: Attach the policy created in Step2 to the user created in step1.
Now your bucket will be accessible only to the user you created with the policies you specified.
Since your policy has a rule
"aws:Referer":["http://www.example.com/*","http://example.com/*"]
the bucket will be accessible only from the urls you have specified.
Upvotes: 1