我正在关注有关如何将静态站点部署到s3和cloudfront的教程
https://miketabor.com/host-static-website-using-aws-s3/
我已经创建了我的S3存储桶,将其设置为公开,然后上传我的文件,例如该网站
http://www.yourdomain.com.s3-website-us-east-1.amazonaws.com
按预期工作,到目前为止一切顺利,现在我按照指南配置了Cloudfront实例
Distribution ID
EMYC0...
ARN
arn:aws:cloudfront::22172726..981:distribution/EMYC0R..AP79B
Log Prefix
log_
Delivery Method
Web
Cookie Logging
Off
Distribution Status
Deployed
Comment
-
Price Class
Use All Edge Locations (Best Performance)
AWS WAF Web ACL
-
State
Enabled
Alternate Domain Names (CNAMEs)
dev.myurl.com
SSL Certificate
*.myurl.com (d89746a9-9d6d-45a9-b53c-ba24..36)
Domain Name
d1l63dvaobxx.cloudfront.net
Custom SSL Client Support
Clients that Support Server Name Indication (SNI) - (Recommended)
Security Policy
TLSv1.1_2016
Supported HTTP Versions
HTTP/2, HTTP/1.1, HTTP/1.0
IPv6
Enabled
Default Root Object
index.html (originally this was empty but I've changed this to index through not works neither)
Last Modified
2019-06-04 21:59 UTC-4
Log Bucket
www.dev.mybucketxx.com.s3.amazonaws.com
查看本文后
我以为问题是默认的根对象,未设置,所以我将其更改为index.html(s3存储桶的根目录中存在index.html)
但我总是会收到此错误
<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>06C89B31EE8CA0A5</RequestId><HostId>NGWaHdZx0EbbzLwVPOMx5DAY6lRgmPBCCInTQeab...IOSMStfnI6pwmu4QpDYU3R0EPNk=</HostId></Error>
我认为该问题一定是在Cloudfront上,因为我可以完美访问S3,但是我找不到这里的问题
这是我的存储桶策略
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "AllowPublicRead",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::xxdomain.com/*"
}
]
}
任何帮助将不胜感激,非常感谢你们!
答案 0 :(得分:1)