我有以下两个CloudFormation资源:
"TestELB" { ... }, "TestRecordSetGroup": { "Type": "AWS::Route53::RecordSetGroup", "Properties": { "HostedZoneName": "example.com.", "RecordSets": [ { "Name": "subdomain.example.com.", "Type": "A", "AliasTarget": { "HostedZoneId": {"Fn::GetAtt": ["TestELB", "CanonicalHostedZoneNameID"]}, "DNSName": {"Fn::GetAtt": ["TestELB", "CanonicalHostedZoneName"]} } }, { "Name": "subdomain.example.com.", "Type": "AAAA", "AliasTarget": { "HostedZoneId": {"Fn::GetAtt": ["TestELB", "CanonicalHostedZoneNameID"]}, "DNSName": {"Fn::Join": [".", ["ipv6", {"Fn::GetAtt": ["TestELB", "CanonicalHostedZoneName"]}]]} } } ] } }
堆栈更新后,我看到我的区域中列出的所有logging都具有预期的别名值。 Alogging的工作原理与digvalidation的一样:
$ dig A subdomain.example.com ... ;; QUESTION SECTION: ;subdomain.example.com. IN A ;; ANSWER SECTION: subdomain.example.com. 59 IN A 11.22.33.44 ;; Query time: 38 msec ...
但AAAAlogging不起作用:
$ dig AAAA subdomain.example.com ... ;; QUESTION SECTION: ;subdomain.example.com. IN AAAA ;; AUTHORITY SECTION: example.com. 899 IN SOA ns-1234.awsdns-11.org. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400 ;; Query time: 54 msec ...
我认为这与Fn :: Join有关,用于添加ipv6. 到ELB的DNS名称的开头。 如果我更改Alogging,所以它使用Fn:Join来预先安装dualstack. 到DNS名称也是以同样的方式失败。
是Fn ::join正确的方式来添加ipv6. 或dualstack. 到一个DNS名称的开始?
原来我太聪明了。 即使CanonicalHostedZoneName中的输出不包含ipv6. 或dualstack. , 在这种情况下你并不需要它。 通过一些在AWS文献中没有很好logging的魔法,logging集理解别名是在A上下文还是在AAAA上下文中并相应地做正确的事情。 完整的工作logging组是:
"TestRecordSetGroup": { "Type": "AWS::Route53::RecordSetGroup", "Properties": { "HostedZoneName": "example.com.", "RecordSets": [ { "Name": "subdomain.example.com.", "Type": "A", "AliasTarget": { "HostedZoneId": {"Fn::GetAtt": ["TestELB", "CanonicalHostedZoneNameID"]}, "DNSName": {"Fn::GetAtt": ["TestELB", "CanonicalHostedZoneName"]} } }, { "Name": "subdomain.example.com.", "Type": "AAAA", "AliasTarget": { "HostedZoneId": {"Fn::GetAtt": ["TestELB", "CanonicalHostedZoneNameID"]}, "DNSName": {"Fn::GetAtt": ["TestELB", "CanonicalHostedZoneName"]} } } ] } }