【问题标题】:CloudFormation creation of CloudFront distribution with logging bucketCloudFormation 使用日志存储桶创建 CloudFront 分配
【发布时间】:2016-06-21 09:23:24
【问题描述】:

尝试配置由 CloudFront 分发的静态网站存储桶。

如果我省略了分配的 Logging 配置,则以下 CloudFormation 模板有效:

{
...

"PrimeBucket": {
    "Properties": {
        "AccessControl": "PublicRead",
        "WebsiteConfiguration": {
            "ErrorDocument": "error.html",
            "IndexDocument": "index.html"
        }
    },
    "Type": "AWS::S3::Bucket"
},
"PrimeBucketDistribution": {
    "Properties": {
        "DistributionConfig": {
            "DefaultCacheBehavior": {
                "AllowedMethods": [
                    "GET",
                    "HEAD",
                    "OPTIONS"
                ],
                "ForwardedValues": {
                    "QueryString": "false"
                },
                "TargetOriginId": "BucketOrigin",
                "ViewerProtocolPolicy": "allow-all"
            },
            "Enabled": "true",
            "Logging": {
                "Bucket": {
                    "Ref": "PrimeBucketLogs"
                },
                "IncludeCookies": "false"
            },
            "Origins": [
                {
                    "DomainName": {
                        "Fn::GetAtt": [
                            "PrimeBucket",
                            "DomainName"
                        ]
                    },
                    "Id": "BucketOrigin",
                    "S3OriginConfig": {}
                }
            ]
        }
    },
    "Type": "AWS::CloudFront::Distribution"
},
"PrimeBucketLogs": {
    "Type": "AWS::S3::Bucket"
}
}

如果我包含 Logging 我会收到错误:

The parameter Logging Bucket does not refer to a valid S3 bucket.

是否需要对日志存储桶应用任何额外的魔法才能使其与 CloudFront 兼容?在文档中找不到任何内容。

【问题讨论】:

  • 你有没有设法解决这个问题?
  • 不记得了:(

标签: amazon-s3 amazon-cloudfront amazon-cloudformation


【解决方案1】:

尝试将您的存储桶名称指定为 "bucketname.s3.amazonaws.com" 而不仅仅是 "bucketname"

【讨论】:

    猜你喜欢
    • 2019-05-21
    • 2016-08-23
    • 2016-12-09
    • 2020-12-04
    • 1970-01-01
    • 2019-12-06
    • 2015-07-23
    • 1970-01-01
    • 2021-10-02
    相关资源
    最近更新 更多