I am using aws s3 to store my website pictures and video contents. File links from s3 are directly output to html/php.
The problem is that some other sites linked my picture/video, which heavily increased s3 traffic usage, and off course increased the pay bill.
I know in some case people use referer header to prohibit external sites linking. But in this case, picture/video go out directly from s3, not my domain.
Can some one help to achieve this? Thanks.
You can use Amazon bucket policy like :
{
"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/*"
]
}
}
}
]
}
which is explained in detail at : http://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html
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