การบล็อกไม่ให้เข้าถึงข้อมูล หากไม่ได้เรียกมาจาก Referrer ที่ระบุ เราสามารถกำหนด bucket policy ของ S3 ดังนี้
{
"Version": "2012-10-17",
"Id": "http referer policy example",
"Statement": [
{
"Sid": "Block get requests originating from other than www.example.com and example.com.",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::examplebucket/*",
"Condition": {
"StringNotLike": {
"aws:Referer": [
"http://www.example.com/*",
"http://example.com/*"
]
}
}
}
]
}
หมายเหตุ เราสามารถกำหนด policy ข้างต้น ร่วมกับการใช้ Presigned URL เพื่อเพิ่มความปลอดภัยของข้อมูลใน S3 ได้
No comments:
Post a Comment