带有Route53的Cloudformation中的“遇到不受支持的属性类型”错误

时间:2019-05-30 17:08:52

标签: json amazon-web-services amazon-cloudformation amazon-route53

当尝试使用cloudformation构建AWS :: Route53 :: RecordSet时,出现“遇到不受支持的属性类型”错误。我假设这意味着它无法识别我的JSON中的“ Type”:“ A”。但是,这是AWS :: Route53 :: RecordSet和is even in the example AWS gives in the documentation.的有效属性(我知道这是针对RecordSetGroup的,但是底部的示例构建了一个RecordSet)。

我还尝试过复制并粘贴亚马逊给出的确切示例,并为我确定其价值。还是没有运气。

这是我的代码:

"DNS" : {
      "Type": "AWS::Route53::RecordSet",
      "Properties": {
        "HostedZoneName": {
          "Ref": "HostedZoneName"
        },
        "Comment": "DNS name for my instance.",
        "Name": {
          "Fn::Join": [
            "",
            [
              {
                "Ref": "ComponentDNSName"
              },
              {
                "Ref": "HostedZoneName"
              }
            ]
          ]
        },
        "Type": "A",
        "TTL": "900",
        "ResourceRecords": [
          {
            "Fn::GetAtt": [
              {
                "Fn::GetAtt": [
                  "Ec2Instance",
                  "PrivateIp"
                ]
              }
            ]
          }
        ]
      }
    }

我认为可能是在错误的位置使用了方括号,但我仔细检查了一下,并确认堆栈中的其他资源(警报,EC2Instance)都正常运行。

谢谢您的帮助。

1 个答案:

答案 0 :(得分:0)

我认为问题是ResourceRecords。用

替换当前的
   "ResourceRecords": [
      {
        "Fn::GetAtt": [
            "Ec2Instance",
            "PrivateIp"
        ]
      }
    ]

如果要向ResourceRecords添加多个输入,它将变为

   "ResourceRecords": [
      {
        "Fn::GetAtt": [
            "name1",
            "resource1"
        ]
      },
      {
        "Fn::GetAtt": [
            "name2",
            "resource2"
        ]
      }
    ]

希望这会有所帮助。