我想限制直接訪問aws s3存儲區中的文件,只有從網站文件應該是可見的,我嘗試了不同的政策。但是沒有任何東西能爲我工作。限制直接訪問s3文件從網站只有它應該打開
{ "Version": "2012-10-17", "Id": "http referer policy example", "Statement": [ { "Sid": "Allow get requests referred by www.example.com and example.com.", "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::ex-bucket/*", "Condition": { "StringLike": {"aws:Referer": ["https://www.example.com/*","https://example.com/*"]} } },
{ "Sid": "IPAllow", "Effect": "Allow", "Principal": "*", "Action": "s3:*", "Resource": "arn:aws:s3:::ex-bucket/*", "Condition": { "NotIpAddress": { "aws:SourceIp": "00.00.000.00" }, "IpAddress": { "aws:SourceIp": "00.00.000.00" } } }
] }
對此有何建議。
檢查您的狀況。它似乎錯了' 「條件」:{ 「NotIpAddress」:{ 「AWS:SOURCEIP」: 「54.24.189.49」 }, 「Ip地址」:{ 「AWS:SOURCEIP」: 「54.24.189.49」 } }' –
感謝您的回覆,您能告訴我它有什麼不對嗎 – Sontya
爲什麼您爲同一個IP設置'NotIpAddress'和'IpAddress'?他們互相沖突 –