AWS cloudfront cli 不使用压缩参数为自定义来源创建 Web 分发
AWS cloudfront cli not creating web distribution for custom origin with compress parameter
我一直在寻找使用 CLI 创建 AWS cloudfront 网络分发,一切正常,直到我尝试添加 "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": ""
}
这是我得到的错误
如果我删除压缩参数它工作正常。
参数验证失败:
DistributionConfig.DefaultCacheBehavior 中的未知参数:"Compress",必须是以下之一:TargetOriginId、ForwardedValues、TrustedSigners、ViewerProtocolPolicy、MinTTL、AllowedMethods、SmoothStreaming、DefaultTTL、MaxTTL
DistributionConfig.CacheBehaviors.Items[0] 中的未知参数:"Compress",必须是以下之一:PathPattern、TargetOriginId、ForwardedValues、TrustedSigners、ViewerProtocolPolicy、MinTTL、AllowedMethods、SmoothStreaming、DefaultTTL、MaxTTL
DistributionConfig.CacheBehaviors.Items[1] 中的未知参数:"Compress",必须是以下之一:PathPattern、TargetOriginId、ForwardedValues、TrustedSigners、ViewerProtocolPolicy、MinTTL、AllowedMethods、SmoothStreaming、DefaultTTL、MaxTTL
在向 AWS 提出申请后,我知道我的云端分发 JSON 绝对没问题,让我头疼的是 CLI 版本
我使用的是 AWS CLI 版本 1.9.12,而 compress 仅支持 CLI 版本 >= 1.9.14
我一直在寻找使用 CLI 创建 AWS cloudfront 网络分发,一切正常,直到我尝试添加 "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": ""
}
这是我得到的错误
如果我删除压缩参数它工作正常。
参数验证失败: DistributionConfig.DefaultCacheBehavior 中的未知参数:"Compress",必须是以下之一:TargetOriginId、ForwardedValues、TrustedSigners、ViewerProtocolPolicy、MinTTL、AllowedMethods、SmoothStreaming、DefaultTTL、MaxTTL DistributionConfig.CacheBehaviors.Items[0] 中的未知参数:"Compress",必须是以下之一:PathPattern、TargetOriginId、ForwardedValues、TrustedSigners、ViewerProtocolPolicy、MinTTL、AllowedMethods、SmoothStreaming、DefaultTTL、MaxTTL DistributionConfig.CacheBehaviors.Items[1] 中的未知参数:"Compress",必须是以下之一:PathPattern、TargetOriginId、ForwardedValues、TrustedSigners、ViewerProtocolPolicy、MinTTL、AllowedMethods、SmoothStreaming、DefaultTTL、MaxTTL
在向 AWS 提出申请后,我知道我的云端分发 JSON 绝对没问题,让我头疼的是 CLI 版本
我使用的是 AWS CLI 版本 1.9.12,而 compress 仅支持 CLI 版本 >= 1.9.14