gpt4 book ai didi

amazon-web-services - 尝试创建或更新 Route53 A 记录时出现 InvalidInput 错误

转载 作者:行者123 更新时间:2023-12-04 15:41:53 26 4
gpt4 key购买 nike

当我运行这个 boto3 来创建或更新 A 记录时,出现错误:

File "./metakube.py", line 523, in post_create self.route53_update_alias_record(self.fugu_editor_external_dns, fugu_elb_identifier)

File "./metakube.py", line 508, in route53_update_alias_record 'EvaluateTargetHealth': False

File "/home/pairaccount/.virtualenvs/fugui-devops/local/lib/python2.7/site-packages/botocore/client.py", line 236, in _api_call return self._make_api_call(operation_name, kwargs)

File "/home/pairaccount/.virtualenvs/fugui-devops/local/lib/python2.7/site-packages/botocore/client.py", line 500, in _make_api_call raise ClientError(parsed_response, operation_name)

botocore.exceptions.ClientError: An error occurred (InvalidInput) when calling the ChangeResourceRecordSets operation: Invalid request



根据 boto3 文档,这看起来是正确的输入。我们也尝试了一些不同的变体,但是当我们尝试使用下面的这种方法创建或插入 A 记录时,我们会收到此错误。我们有一个类似的方法调用 change_resource_record_sets删除 A 记录,它工作正常。

关于需要纠正什么的任何想法?
def route53_update_alias_record(self, external_dns_name, load_balancer_identifier):
route53_client = boto3.client('route53')
hosted_zone_id = self.get_hosted_zone_id(route53_client)

response = route53_client.change_resource_record_sets(
HostedZoneId=hosted_zone_id,
ChangeBatch={
'Comment': 'upsert alias record',
'Changes': [
{
'Action': 'UPSERT',
'ResourceRecordSet': {
'Name': external_dns_name,
'Type': 'A',
'Region': 'us-east-1',
'AliasTarget': {
'DNSName': load_balancer_identifier,
'HostedZoneId': 'Z3DZXE0Q79N41H',
'EvaluateTargetHealth': False
}
}
}
]
}
)
self.logger.info("Delete route53 alias {} response: {}".format(external_dns_name, response))

最佳答案

你需要TTL

喜欢 :

response = client.change_resource_record_sets(
HostedZoneId=hostedzoneid,
ChangeBatch={
'Comment': 'add record',
'Changes': [
{
'Action': 'UPSERT',
'ResourceRecordSet': {
'Name': name,
'Type': 'A',
'TTL': ttl,
'ResourceRecords': [
{
'Value': value
}
]
}
}
]
}
)

关于amazon-web-services - 尝试创建或更新 Route53 A 记录时出现 InvalidInput 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36489624/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com