AWS Route 53 Zone

This page shows how to write Terraform and CloudFormation for Route 53 Zone and write them securely.

aws_route53_zone (Terraform)

The Zone in Route 53 can be configured in Terraform with the resource name aws_route53_zone. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

aws_zone_setup.tf#L1
resource "aws_route53_zone" "dotmedia" {
  name = "infectious.media"
}

resource "aws_route53_zone" "mediafr" {
  name = "infectiousmedia.fr"
aws_zone_setup.tf#L1
resource "aws_route53_zone" "dotmedia" {
  name = "infectious.media"
}

resource "aws_route53_zone" "mediafr" {
  name = "infectiousmedia.fr"
zones.tf#L1
resource "aws_route53_zone" "beryju-org" {
  name = "beryju.org"
}

resource "aws_route53_zone" "jela-io" {
  name = "jela.io"
route_53.tf#L1
resource "aws_route53_zone" "holepunch" {
  name = "holepunch.io"
}

resource "aws_route53_zone" "hole_ly" {
  name = "hole.ly"
dns.tf#L3
resource "aws_route53_zone" "public" {
  name    = var.domain
  comment = var.prefix

  tags = merge(
    var.tags,

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Manages a Route53 Hosted Zone. For managing Domain Name System Security Extensions (DNSSEC), see the aws_route53_key_signing_key and aws_route53_hosted_zone_dnssec resources.

AWS::Route53::HostedZone (CloudFormation)

The HostedZone in Route53 can be configured in CloudFormation with the resource name AWS::Route53::HostedZone. The following sections describe 10 examples of how to use the resource and its parameters.

Example Usage from GitHub

hosted_zones.yml#L7
    Type: "AWS::Route53::HostedZone"
  reckerfamilycom:
    DeletionPolicy: Retain
    Properties:
      Name: "reckerfamily.com."
    Type: "AWS::Route53::HostedZone"
prod.yml#L5
    Type: "AWS::Route53::HostedZone"
    Properties:
      HostedZoneConfig:
        Comment: !Sub "Created by CloudFormation stack: ${AWS::StackName}"
      Name: suggpro.fr
    DeletionPolicy: Delete
dns.yml#L13
    Type: AWS::Route53::HostedZone
    Properties:
      HostedZoneConfig:
        Comment:
          Fn::Join:
          - ''
dns.yml#L13
    Type: AWS::Route53::HostedZone
    Properties:
      HostedZoneConfig:
        Comment:
          Fn::Join:
          - ''
static-web-hosting-s3-route-53.yml#L11
#                Type: AWS::Route53::HostedZone::Id
#                Description: An Amazon Route 53 hosted zone ID

Resources:
        MyS3Bucket:
                Type: AWS::S3::Bucket
route53.json#L8
      "Type" : "AWS::Route53::HostedZone",
      "Properties" : {
        "Name" : "dirtybit.io" }
      },
    "dirtybitnl": {
      "Type" : "AWS::Route53::HostedZone",
Route53.json#L65
  "resourceType" : "AWS::Route53::HostedZone",
  "properties" : [ {
    "propertyName" : "HostedZoneConfig",
    "propertyType" : "AWS::Route53::HostedZone::HostedZoneConfig",
    "required" : false,
    "propertyHref" : "aws-properties-route53-hostedzone-hostedzoneconfig.html"
integ.cross-account-zone-delegation.expected.json#L4
      "Type": "AWS::Route53::HostedZone",
      "Properties": {
        "Name": "myzone.com."
      }
    },
    "ParentHostedZoneCrossAccountZoneDelegationRole95B1C36E": {
integ.route53.expected.json#L200
      "Type": "AWS::Route53::HostedZone",
      "Properties": {
        "Name": "cdk.local.",
        "VPCs": [
          {
            "VPCId": {
integ.route53.expected.json#L200
      "Type": "AWS::Route53::HostedZone",
      "Properties": {
        "Name": "cdk.local.",
        "VPCs": [
          {
            "VPCId": {

Parameters

Explanation in CloudFormation Registry

Creates a new public or private hosted zone. You create records in a public hosted zone to define how you want to route traffic on the internet for a domain, such as example.

com, and its subdomains (apex.

example.

com, acme.

example.

com). You create records in a private hosted zone to define how you want to route traffic for a domain and its subdomains within one or more Amazon Virtual Private Clouds (Amazon VPCs). Important You can't convert a public hosted zone to a private hosted zone or vice versa. Instead, you must create a new hosted zone with the same name and create new resource record sets.

For more information about charges for hosted zones, see Amazon Route 53 Pricing.

Note the following:+ You can't create a hosted zone for a top-level domain (TLD) such as .

com.

  • For public hosted zones, Route 53 automatically creates a default SOA record and four NS records for the zone. For more information about SOA and NS records, see NS and SOA Records that Route 53 Creates for a Hosted Zone in the Amazon Route 53 Developer Guide. If you want to use the same name servers for multiple public hosted zones, you can optionally associate a reusable delegation set with the hosted zone. See the DelegationSetId element.

  • If your domain is registered with a registrar other than Route 53, you must update the name servers with your registrar to make Route 53 the DNS service for the domain. For more information, see Migrating DNS Service for an Existing Domain to Amazon Route 53 in the Amazon Route 53 Developer Guide. When you submit a CreateHostedZone request, the initial status of the hosted zone is PENDING. For public hosted zones, this means that the NS and SOA records are not yet available on all Route 53 DNS servers. When the NS and SOA records are available, the status of the zone changes to INSYNC.

The CreateHostedZone request requires the caller to have an ec2:DescribeVpcs permission.

Frequently asked questions

What is AWS Route 53 Zone?

AWS Route 53 Zone is a resource for Route 53 of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS Route 53 Zone?

For Terraform, the max-l-weaver/route52_dyn_terraform, max-l-weaver/terraform_route53_dyn and BeryJu/infrastructure source code examples are useful. See the Terraform Example section for further details.

For CloudFormation, the arecker/infra, Benjamin-99/Webapp and vincentjorgensen/jib source code examples are useful. See the CloudFormation Example section for further details.