Frodo
Frodo

Reputation: 583

AWS: Get Route53 HostedZone Name

im adding set of records to route53 from cloud formation and here is the code

 "RDSDNSRecord" : {
      "Type" : "AWS::Route53::RecordSet",
      "Properties" : {

         "HostedZoneId" : { "Ref" : "DNSZoneId" },
         "Comment" : "DNS name for RDS",  
         "Name" : { "Fn::Join" : [ "", [ {  "Ref": "EnvType"}, "." ,"rds",".",{"Ref" : "AWS::Region"} ,".",{"Ref" : "HostedZone"},"." ] ] },
         "Type" : "CNAME",
         "TTL" : "900",
         "ResourceRecords" : [
           {
            "Ref": "DatabaseEndPoint"
         }
         ]
      }
   }

and HostedZones are already created before. so in order to set these records i use these parameters.

"DNSZoneId":{
         "Type" :"AWS::Route53::HostedZone::Id",
         "ConstraintDescription":"must be the name of an existing ZoneId"
      },
      "HostedZone":{
         "Type": "String",
          "Description":"Relavent Domain Name"
      }

aws requires fully qualified domain name to be pass into parameter Name. so i asked DomainName from user along with ZoneId. I feel like asking ID and Name both is not right. is there a way to get name from zoneId or any workaround?

Upvotes: 3

Views: 1384

Answers (1)

Sudharsan Sivasankaran
Sudharsan Sivasankaran

Reputation: 5897

HostedZoneId is optional, you can also use HostedZoneName

HostedZoneId The ID of the hosted zone.

Required: Conditional. You must specify either the HostedZoneName or HostedZoneId, but you cannot specify both. If this record set is part of a record set group, do not specify this property.

Upvotes: 1

Related Questions