Last active
November 1, 2025 22:37
-
-
Save kwilczynski/f991d9e8b36cd38dbf493e8e495b69a7 to your computer and use it in GitHub Desktop.
Route53 Hosted Zone - CloudFormation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "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" | |
| } | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "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" | |
| } | |
| } | |
| } | |
| } |
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...
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
ok, I see why the CF template is different to the API.
CF makes the zone provate if VPC's are added, and makes it public if there are no VPC's associated.