Skip to content

AWS Route53 DNS

udx-github edited this page May 28, 2026 · 1 revision

Manages Route53 hosted zones, DNS records, and optional domain registration.

Use this module when a Rabbit service needs DNS records, a hosted zone, or Route53 domain registration managed alongside the rest of its infrastructure.

Supported Features

  • Hosted zone creation.
  • Existing public hosted zone lookup.
  • Standard DNS records.
  • Alias records for AWS targets such as CloudFront or load balancers.
  • Multiple records with the same name and type consolidated into one Route53 record set.
  • Automatic TXT chunking for values longer than Route53's 255-character string limit.
  • Optional existing domain management.
  • Optional new domain registration with destroy protection.

Prerequisites

  • AWS credentials with Route53 permissions.
  • Route53 Domains permissions when using domain registration.
  • An existing public hosted zone when create_hosted_zone is false.
  • Target hosted zone IDs for alias records. For CloudFront aliases, use CloudFront's fixed hosted zone ID: Z2FDTNDATAQYW2.

Important Notes

  • domain is the base domain for the hosted zone and records.
  • Use name: "@" for the zone apex.
  • Standard records use value; alias records use alias.
  • TXT records can use a single string or a list of strings.
  • create_hosted_zone: false looks up an existing public hosted zone by domain.
  • register_domain and enable_domain_registration are mutually exclusive.
  • New domain registration uses Terraform prevent_destroy.

Minimal Example

services:
  - name: "AWS Route53 DNS"
    module: "aws-route53"
    id: "example-com-dns"
    deployment_order: 5
    configurations:
      domain: "example.com"
      create_hosted_zone: false
      records:
        - name: "@"
          type: A
          alias:
            name: "d111111abcdef8.cloudfront.net"
            zone_id: "Z2FDTNDATAQYW2"
            evaluate_target_health: false
        - name: "@"
          type: TXT
          value: "v=spf1 include:_spf.example.com ~all"
          ttl: 300
      tags:
        owner: "#{Owner}"
        lifecycle: "#{Lifecycle}"

Outputs

Output Description
route53_zone_id Hosted zone ID used by this module.
zone_name_servers Name servers for a newly created hosted zone.
domain_name Configured domain name.
hosted_zone_arn ARN for a newly created hosted zone, or an empty string when using an existing zone.
domain_registered Whether this module registered a new domain.
domain_registration_status Status list returned for a newly registered domain.
domain_expiration_date Expiration date returned for a newly registered domain.

Full Configuration Schema

The fields below are public module inputs under configurations.

configurations:
  domain: "example.com"
  create_hosted_zone: true
  enable_domain_registration: false
  register_domain: false
  auto_renew: true
  registrant_contact: {}
  records: []
  tags: {}

Top-Level Fields

Field Type Required Description
domain string Yes Base domain name.
create_hosted_zone boolean No Creates a public hosted zone when true; looks up an existing zone when false. Defaults to true.
enable_domain_registration boolean No Manages settings for an already registered Route53 domain. Mutually exclusive with register_domain. Defaults to false.
register_domain boolean No Registers a new domain through Route53 Domains. Mutually exclusive with enable_domain_registration. Defaults to false.
auto_renew boolean No Enables domain auto-renewal when domain registration is managed. Defaults to true.
registrant_contact object Conditional Contact details used when registering a domain.
records array[record] No DNS records to manage. Defaults to [].
tags map[string] No Tags merged with module-managed tags.

records

Standard records:

records:
  - name: "www"
    type: CNAME
    value: "example.com"
    ttl: 300

Alias records:

records:
  - name: "@"
    type: A
    alias:
      name: "d111111abcdef8.cloudfront.net"
      zone_id: "Z2FDTNDATAQYW2"
      evaluate_target_health: false
Field Type Required Description
name string Yes Record name relative to domain. Use @ for the apex.
type string Yes DNS record type, such as A, AAAA, CNAME, MX, TXT, CAA, or SRV.
value string or array[string] Required for standard records DNS record value or values. TXT values are chunked automatically when needed.
ttl number No Record TTL in seconds for standard records. Defaults to 300.
alias object Required for alias records Alias target configuration. Alias records do not use ttl or value.

records[].alias

Field Type Required Description
name string Yes Alias target DNS name.
zone_id string Yes Hosted zone ID for the alias target.
evaluate_target_health boolean No Whether Route53 evaluates target health. Defaults to false.

registrant_contact

Field Type Required Description
first_name string Yes Registrant first name.
last_name string Yes Registrant last name.
contact_type string No Route53 contact type. Defaults to PERSON.
organization_name string No Organization name for company contacts.
address_line_1 string Yes Street address.
city string Yes City.
state string Yes State or region.
country_code string Yes Two-letter country code.
zip_code string Yes Postal code.
phone_number string Yes Phone number in Route53 format, such as +1.5551234567.
email string Yes Registrant email address.

Clone this wiki locally