aws config_error ai_generated true

指定的默认根对象无效。该对象必须位于分发的源中。

The specified default root object is not valid. The object must be in the distribution's origin.

ID: aws/cloudfront-invalid-default-root-object

其他格式: JSON · Markdown 中文 · English
90%修复率
86%置信度
1证据数
2024-08-12首次发现

版本兼容性

版本状态引入弃用备注
cloudfront-2024 active
aws-cli/2.17.0 active
s3-2024 active

根因分析

CloudFront 分发的默认根对象(例如 index.html)在 S3 存储桶或自定义源的根路径中不存在。

English

The CloudFront distribution's Default Root Object (e.g., index.html) does not exist in the S3 bucket or custom origin at the root path.

generic

官方文档

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DefaultRootObject.html

解决方案

  1. 将默认根对象上传到 S3 存储桶根目录:`aws s3 cp index.html s3://my-bucket/index.html` 并确保存储桶策略允许公共读取(如果适用)。
  2. 如果使用自定义源,将文件放置在源根目录(例如 EC2 Web 服务器的 /var/www/html/index.html)。

无效尝试

常见但无效的做法:

  1. 80% 失败

    Setting the Default Root Object to a path with a leading slash (e.g., '/index.html') is invalid; CloudFront expects no leading slash.

  2. 90% 失败

    Uploading the file to a subfolder instead of the bucket root won't work; the root object must be at the origin root.