2016-03-07 71 views
3

试图规定,通过真实分布CloudFront的静态网站水桶CloudFront的分布。CloudFormation创建伐木斗

以下CloudFormation模板工程,如果我省略了Logging配置分布:

{ 
... 

"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的兼容应用到日志斗?在文档中找不到任何内容。

+0

你有没有设法想出解决办法? –

+0

不记得:( –

回答

4

尝试指定你的水桶名"bucketname.s3.amazonaws.com",而不仅仅是"bucketname"