How to do it...

  1. Create a new CloudFormation template and add the following Parameter to it:
      Parameters:         DomainName:           Description: Your domain name (example.org)           Type: String
  1. Next we need to add a HostedZone resource to our template, as follows:
      Resources:         DNSHostedZone:            Type: AWS::Route53::HostedZone           Properties:             Name: !Ref DomainName
  1. You're now ready to go ahead and create your hosted zone in Route 53. You can do so via the CloudFormation web console, or use the following CLI command:
      aws cloudformation create-stack \        --stack-name example-hosted-zone \        --template-body file://07-hosting-a-domain.yaml \        --parameters \        ParameterKey=DomainName,ParameterValue=<your-domain-name>

Get AWS Administration Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.