Skip to content

Instantly share code, notes, and snippets.

@kwilczynski
Last active December 29, 2021 03:17
Show Gist options
  • Save kwilczynski/f991d9e8b36cd38dbf493e8e495b69a7 to your computer and use it in GitHub Desktop.
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"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment