我希望使用CLI创建AWS云端Web分发,一切正常,直到我尝试将" Compress":True 添加到分发的JSON中。
以下是我的配置
{
"CallerReference": "string",
"Aliases": {
"Items": [
"test.example.com"
],
"Quantity": 1
},
"DefaultRootObject": "",
"Origins": {
"Items": [
{
"OriginPath": "",
"CustomOriginConfig": {
"OriginProtocolPolicy": "match-viewer",
"HTTPPort": 80,
"HTTPSPort": 443
},
"Id": "Custom-example.com",
"DomainName": "example.com"
}
],
"Quantity": 1
},
"DefaultCacheBehavior": {
"TrustedSigners": {
"Enabled": false,
"Quantity": 0
},
"TargetOriginId": "Custom-example.com",
"ViewerProtocolPolicy": "allow-all",
"ForwardedValues": {
"Headers": {
"Quantity": 0
},
"Cookies": {
"Forward": "none"
},
"QueryString": false
},
"MaxTTL": 31536000,
"Compress": true,
"SmoothStreaming": false,
"DefaultTTL": 86400,
"AllowedMethods": {
"Items": [
"HEAD",
"GET"
],
"CachedMethods": {
"Items": [
"HEAD",
"GET"
],
"Quantity": 2
},
"Quantity": 2
},
"MinTTL": 0
},
"CacheBehaviors": {
"Quantity": 2,
"Items": [ {
"TrustedSigners": {
"Enabled": false,
"Quantity": 0
},
"TargetOriginId": "Custom-example.com",
"ViewerProtocolPolicy": "allow-all",
"ForwardedValues": {
"Headers": {
"Quantity": 0
},
"Cookies": {
"Forward": "none"
},
"QueryString": false
},
"MaxTTL": 31536000,
"Compress": true,
"PathPattern": "*.jpeg",
"SmoothStreaming": false,
"DefaultTTL": 86400,
"AllowedMethods": {
"Items": [
"HEAD",
"GET"
],
"CachedMethods": {
"Items": [
"HEAD",
"GET"
],
"Quantity": 2
},
"Quantity": 2
},
"MinTTL": 60
}
,
{
"TrustedSigners": {
"Enabled": false,
"Quantity": 0
},
"TargetOriginId": "Custom-example.com",
"ViewerProtocolPolicy": "allow-all",
"ForwardedValues": {
"Headers": {
"Quantity": 0
},
"Cookies": {
"Forward": "none"
},
"QueryString": false
},
"MaxTTL": 31536000,
"Compress": true,
"PathPattern": "*.png",
"SmoothStreaming": false,
"DefaultTTL": 86400,
"AllowedMethods": {
"Items": [
"HEAD",
"GET"
],
"CachedMethods": {
"Items": [
"HEAD",
"GET"
],
"Quantity": 2
},
"Quantity": 2
},
"MinTTL": 100
}
]
},
"CustomErrorResponses": {
"Quantity": 0
},
"Comment": "my distro",
"Logging": {
"Bucket": "",
"Prefix": "",
"Enabled": false,
"IncludeCookies": false
},
"PriceClass": "PriceClass_100",
"Enabled": true,
"ViewerCertificate": {
"CloudFrontDefaultCertificate": true,
"MinimumProtocolVersion": "SSLv3"
},
"Restrictions": {
"GeoRestriction": {
"Items": [
"IN",
"GB",
"IR"
],
"RestrictionType": "whitelist",
"Quantity": 3
}
},
"WebACLId": ""
}
这是我得到的错误
如果我删除了compress参数,它可以正常工作。
参数验证失败: DistributionConfig.DefaultCacheBehavior中的未知参数:&#34;压缩&#34;,必须是以下之一:TargetOriginId,ForwardedValues,TrustedSigners,ViewerProtocolPolicy,MinTTL,AllowedMethods,SmoothStreaming,DefaultTTL,MaxTTL DistributionConfig.CacheBehaviors.Items [0]中的未知参数:&#34;压缩&#34;,必须是以下之一:PathPattern,TargetOriginId,ForwardedValues,TrustedSigners,ViewerProtocolPolicy,MinTTL,AllowedMethods,SmoothStreaming,DefaultTTL,MaxTTL DistributionConfig.CacheBehaviors.Items [1]中的未知参数:&#34;压缩&#34;,必须是以下之一:PathPattern,TargetOriginId,ForwardedValues,TrustedSigners,ViewerProtocolPolicy,MinTTL,AllowedMethods,SmoothStreaming,DefaultTTL,MaxTTL < / p>
答案 0 :(得分:1)
在使用AWS提出票证后,我知道我的cloudfront发行版JSON绝对没问题,令人头疼的是CLI版本
我使用的是AWS CLI版本1.9.12,而压缩仅支持CLI版本&gt; = 1.9.14