Amazon web services Cloudformation:无法同时创建ELB和DNSRecord
我正在通过CloudFormation创建一整套服务。创建ELB,然后创建ELB DNSName的DNS记录集。记录集取决于ELBAmazon web services Cloudformation:无法同时创建ELB和DNSRecord,amazon-web-services,amazon-cloudformation,Amazon Web Services,Amazon Cloudformation,我正在通过CloudFormation创建一整套服务。创建ELB,然后创建ELB DNSName的DNS记录集。记录集取决于ELB "dns": { "Type": "AWS::Route53::RecordSetGroup", "Properties": { "HostedZoneName": "*******.com.", "RecordSets": [ { "Name": { "Fn::Join": [
"dns": {
"Type": "AWS::Route53::RecordSetGroup",
"Properties": {
"HostedZoneName": "*******.com.",
"RecordSets": [
{
"Name": {
"Fn::Join": [
"",
[
"\\052.",
{
"Ref": "EnvUrl"
},
".******.com"
]
]
},
"Type": "A",
"AliasTarget": {
"HostedZoneId": "Z3******O77V",
"DNSName": {"Fn::GetAtt": [ "elb", "DNSName" ]}
}
}
]
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "c1513eaa-fdaa-4fef-b50c-bdd178dd0446"
}
},
"DependsOn": [
"elb"
]
}
"elb": {
"Type": "AWS::ElasticLoadBalancing::LoadBalancer",
"Properties": {
"Policies": [
{
"PolicyName": "AWSConsole-SSLNegotiationPolicy",
"PolicyType": "SSLNegotiationPolicyType",
"Attributes": [
{
"Name": "Reference-Security-Policy",
.......
问题是CloudFormation无法创建记录集。错误:
Tried to create an alias that targets ctf21-elb-1huy2****pkn-727***38.eu-central-1.elb.amazonaws.com,
type A in zone Z3******O77V, but the alias target name does not lie within the target zone
我相信这可能是因为负载平衡器在创建之后不可用。就像手动创建一样,它不会立即显示在Route53的别名选择字段中,但需要几分钟
我还尝试使用Fn::Join
添加dualstack.-dnsname-
,输出相同
我做错什么了吗?是否有比我更好的方法来解决此问题?您的ELB区域可能是错误的 在别名目标中尝试此操作
"AliasTarget": {
"DNSName": { "Fn::GetAtt": [ "elb", "DNSName" ]},
"HostedZoneId": { "Fn::GetAtt": [ "elb", "CanonicalHostedZoneNameID"]}
}
Aaaaah我想我必须把我的Route53托管区ID放在这里,我没有意识到ELB有另一个托管区ID。我现在来测试,效果很好。谢谢。当你有一个“双堆栈”的时候,这似乎不起作用。