我有一个python脚本,它将现有的CloudFront分配及其设置复制到另一个AWS账户。
但是我收到了这个错误:
Traceback (most recent call last):
File "cf.py", line 105, in <module>
setup_cloudfront(j)
File "cf.py", line 90, in setup_cloudfront
metropolis_client.create_distribution(DistributionConfig=config)
File "C:\Python36\lib\site-packages\botocore\client.py", line 312, in _api_call
return self._make_api_call(operation_name, kwargs)
File "C:\Python36\lib\site-packages\botocore\client.py", line 601, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.errorfactory.InvalidTTLOrder: An error occurred (InvalidTTLOrder) when calling the CreateDistribution operation: MinTTL, MaxTTL and DefaultTTL should follow order MinTTL less than or equal to DefaultTTL less than or equal to MaxTTL
这是代码的一部分
def setup_cloudfront(j):
config = deepcopy(DISTRO_CONFIG)
config['CallerReference'] = j['CallerReference']
config['Aliases'] = j['Aliases']
config['CacheBehaviors'] = j['CacheBehaviors']
config['Origins'] = j['Origins']
config['DefaultCacheBehavior'] = j['DefaultCacheBehavior']
config['DefaultCacheBehavior']['MinTTL'] = 0
config['DefaultCacheBehavior']['MaxTTL'] = 31536000
config['DefaultCacheBehavior']['DefaultTTL'] = 86400
config['PriceClass'] = j['PriceClass']
config['Enabled'] = j['Enabled']
# config['HttpVersion'] = j['HttpVersion']
config['IsIPV6Enabled'] = j['IsIPV6Enabled']
print(config['CallerReference'], config['Aliases'], config['DefaultCacheBehavior'])
client.create_distribution(DistributionConfig=config)
非常感谢任何建议