创建存储桶
存储桶的名称最好跟网站域名一致,比如excample.com。
属性
- 静态网站托管
主要设置一下几个点 - 阻止公有访问(存储桶设置)
- 关闭
阻止所有公开访问
- 关闭
- 存储桶策略
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::excample.com/*",
"Condition": {
"StringLike": {
"aws:Referer": "xxxxxxxx"
}
}
}
]
}
这个地方的Condition是为了使用cloudfront,限制只能通过cloudfront访问的。如果不使用cloudfront的话,可以去掉。