Skip to content

Instantly share code, notes, and snippets.

@kwilczynski
Last active November 1, 2025 22:37
Show Gist options
  • Select an option

  • Save kwilczynski/f991d9e8b36cd38dbf493e8e495b69a7 to your computer and use it in GitHub Desktop.

Select an option

Save kwilczynski/f991d9e8b36cd38dbf493e8e495b69a7 to your computer and use it in GitHub Desktop.
Route53 Hosted Zone - CloudFormation
{
"AWSTemplateFormatVersion":"2010-09-09",
"Description":"A CloudFormation template for creating a Hosted Zone in Route53.",
"Parameters":{
"Name":{
"Description":"A fully-qualified domain name.",
"Type":"String",
"MinLength":"1",
"MaxLength":"64",
"AllowedPattern":"(?!-)[a-zA-Z0-9-.]*(?<!-)",
"ConstraintDescription":"must be a valid fully-qualified domain name.",
"Default":""
},
"Comment":{
"Description":"An optinal comment about the hosted zone.",
"Type":"String",
"MinLength":"1",
"MaxLength":"255",
"AllowedPattern":"[-_ a-zA-Z0-9]*",
"ConstraintDescription":"can contain only alphanumeric characters, spaces, dashes and underscores.",
"Default":"Managed by CloudFormation."
}
},
"Resources":{
"HostedZone":{
"Type":"AWS::Route53::HostedZone",
"Properties":{
"HostedZoneConfig":{
"Comment":""
},
"Name":{
"Ref":"Name"
},
"HostedZoneTags":[
{
"Key":"StackName",
"Value": {
"Ref": "AWS::StackName"
}
}
]
}
}
},
"Outputs":{
"HostedZoneName":{
"Description":"The fully-qualified domain name.",
"Value": {
"Ref":"Name"
}
},
"HostedZoneID":{
"Description":"The ID of the Hosted Zone.",
"Value": {
"Ref":"HostedZone"
}
}
}
}
{
"AWSTemplateFormatVersion":"2010-09-09",
"Description":"A CloudFormation template for creating a Private Hosted Zone in Route53.",
"Parameters":{
"Name":{
"Description":"A fully-qualified domain name.",
"Type":"String",
"MinLength":"1",
"MaxLength":"64",
"AllowedPattern":"(?!-)[a-zA-Z0-9-.]*(?<!-)",
"ConstraintDescription":"must be a valid fully-qualified domain name.",
"Default":""
},
"Comment":{
"Description":"An optinal comment about the hosted zone.",
"Type":"String",
"MinLength":"1",
"MaxLength":"255",
"AllowedPattern":"[-_ a-zA-Z0-9]*",
"ConstraintDescription":"can contain only alphanumeric characters, spaces, dashes and underscores.",
"Default":"Managed by CloudFormation."
},
"VpcId":{
"Description":"An ID of the VPC for which to create Private Hosted Zone.",
"Type":"AWS::EC2::VPC::Id"
}
},
"Resources":{
"PrivateHostedZone":{
"Type":"AWS::Route53::HostedZone",
"Properties":{
"HostedZoneConfig":{
"Comment":""
},
"Name":{
"Ref":"Name"
},
"VPCs":[
{
"VPCId":{
"Ref":"VpcId"
},
"VPCRegion":{
"Ref":"AWS::Region"
}
}
],
"HostedZoneTags":[
{
"Key":"StackName",
"Value": {
"Ref": "AWS::StackName"
}
}
]
}
}
},
"Outputs":{
"PrivateHostedZoneName":{
"Description":"The fully-qualified private domain name.",
"Value": {
"Ref":"Name"
}
},
"PrivateHostedZoneID":{
"Description":"The ID of the Private Hosted Zone.",
"Value": {
"Ref":"PrivateHostedZone"
}
}
}
}
@kwilczynski
Copy link
Author

@crowne if you are using this, then bare in mind that this is almost a decade old. The CloudFormation most likely have been updated and gained a lot new features and fixes. Thus, it would be prudent to see what is offered now. I personally haven't been looking at this template for a very long time...

@crowne
Copy link

crowne commented Nov 1, 2025

Thanks, it was a useful reference not too different from current for my needs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment