This is my bucket policy:
{
"Version": "2012-10-17",
"Id": "Policy3451901640290",
"Statement": [
{
"Sid": "Stmt3451901619319",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::bucket1/*"
}
]
}
And this is my cors:
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>DELETE</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<ExposeHeader>ETag</ExposeHeader>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
All files inside my bucket must be reading accessible for everyone but only viewable through my website, Is there a simple way to deny direct access to S3?
UPDATE
I tried to add this to my policy:
"Condition":{
"StringLike":{"aws:Referer":["http://www.example.com/*","http://example.com/*"]}
}
Anyway I can access all my files outside of my website directly through S3 instead I would like something like this:
Suppose I have this file on my bucket:
https://s3-eu-west-1.amazonaws.com/bucket1/example.jpg
If a user go to that link now he/she can see that image. Instead I would like to be accessible only from my website.
Let's say on my example.com I have this:
<img src="https://s3-eu-west-1.amazonaws.com/bucket1/example.jpg" />