0
votes

When attempting to build a AWS::Route53::RecordSet using cloudformation, I get "Encountered unsupported property Type" error. I am assuming this means it does not recognize "Type": "A" in my JSON. However, that is a valid property of AWS::Route53::RecordSet and is even in the example AWS gives in the documentation. (I understand this is for RecordSetGroup, but the example at the bottom builds a RecordSet).

I have also tried copying and pasting the exact example Amazon gives and subbing out their values for mine. Still no luck.

Here is my code:

"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"
                ]
              }
            ]
          }
        ]
      }
    }

I thought it might be brackets in the wrong places, but I have double checked that and other resources in my stack (alarms, EC2Instance) build fine.

Thank you for any help.

1
Are you sure it's complaining about "Type" in this part of the code and not somewhere else? Have you tried removing this entire resource?kichik
I have tried that. If I remove the DNS entry, the rest builds fine.Brandon
Why the Fn::GetAtt inside another Fn::GetAtt?jogold

1 Answers

1
votes

The issue is with ResourceRecords I think. Replace the current one with

   "ResourceRecords": [
      {
        "Fn::GetAtt": [
            "Ec2Instance",
            "PrivateIp"
        ]
      }
    ]

If you have multiple inputs to be added to ResourceRecords, it will become

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

Hope this helps.