gpt4 book ai didi

amazon-web-services - Route53,AWS-CLI : Add Alias A name with aws-cli

转载 作者:行者123 更新时间:2023-12-05 01:32:53 25 4
gpt4 key购买 nike

我有一个要求,其中 Kubernetes 服务使用 DNS 名称为我们生成一个 ELB。我将其添加为 A 的别名,与 CNAME 相比,它提供更快的 DNS 传播。我想通过 shell 脚本自动添加条目,但没有成功,我收到如下所述的错误。请注意,所有电子

错误日志:

An error occurred (InvalidChangeBatch) when calling the ChangeResourceRecordSets operation: [Tried to create an alias that targets dualstack.AXXXXXXXXX-46346364.eu-central-1.elb.amazonaws.com., type A in zone Z0jshgdjhdg, but the alias target name does not lie within the target zone, Tried to create an alias that targets dualstack.asdgdfhgdfh-56767687.eu-central-1.elb.amazonaws.com., type A in zone Z0XXXXX, but that target was not found]

使用的命令:

aws route53 change-resource-record-sets --hosted-zone-id /hostedzone/Z0XXXXXXX --change-batch '{"Changes": [ { "Action": "UPSERT", "ResourceRecordSet": { "Name": "test.dev.domain.com", "Type": "A", "AliasTarget":{ "HostedZoneId": "Z0XXXXX","DNSName": "aesdgdfg-46456.eu-central-1.elb.amazonaws.com","EvaluateTargetHealth": false} } } ]}'

我做错了什么?

要求的托管区域:

enter image description here

最佳答案

基于评论。

此问题是由于在 AliasTarget 中使用了错误的 HostedZoneId 引起的。正确的是与您的 ALB 关联的 HostedZoneId。它可以在 EC2 控制台的 Description 选项卡的 ALB 的 Hosted zone 选项下找到。

该命令应使用两个 HostedZoneId:

aws route53 change-resource-record-sets \
--hosted-zone-id /hostedzone/<zone-id-from-route53>\
--change-batch \
'{"Changes": [ { "Action": "UPSERT", "ResourceRecordSet": { "Name": "test.dev.domain.com", "Type": "A", "AliasTarget":{ "HostedZoneId": "<zone-id-of-ALB>","DNSName": "aesdgdfg-46456.eu-central-1.elb.amazonaws.com","EvaluateTargetHealth": false} } } ]}'

关于amazon-web-services - Route53,AWS-CLI : Add Alias A name with aws-cli,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65176811/

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