Skip to main content

DNS Zone (Public)

πŸ“¦ Overview​

This Terraform module provisions a public Route 53 hosted zone for a given domain name, allowing DNS resolution over the internet.

It serves as the foundational layer for routing traffic to cloud-hosted services like websites, APIs, or load balancers.


βœ… Key Features​

  • Creates a Route 53 public hosted zone
  • Accepts domain name and AWS region as input
  • Tags all resources with environment and ownership metadata
  • Outputs name servers for registrar configuration

πŸ’Ό Use Cases​

  • Hosting public websites or APIs behind custom domain names
  • Registering subdomains for cloud infrastructure (e.g., app.example.com)
  • Managing domain routing to S3 static sites, ALBs, or CloudFront distributions
  • Starting point for full public DNS management infrastructure

πŸ“₯ Input Variables​

NameTypeDescription
regionstringAWS region where the DNS zone will be managed
domain_namestringPublic domain name (e.g., example.com)
environmentstringTag to specify the deployment environment (e.g., dev, prod)

πŸ“€ Outputs​

NameDescription
zone_idThe ID of the created Route 53 public hosted zone
zone_name_serversList of name servers to configure with your domain registrar

πŸš€ Deployment Readiness​

  • βœ… Compatible with Terraform 1.0+
  • βœ… Tested with AWS provider 5.x
  • πŸ§ͺ Requires domain ownership and access to a registrar for NS configuration

πŸ› οΈ Example Usage​

module "dns_zone_public" {
source = "git::ssh://git@github.com/archiphire/aws-level-1-modules.git//network/dns-zone-public?ref=v1.0.0"

region = "us-east-1"
domain_name = "example.com"
environment = "prod"
}
terraform init
terraform plan
terraform apply

or

tofu init
tofu plan
tofu apply

🧹 Cleanup Options​

For testing:

terraform destroy

or

tofu destroy

For production:

Manually delete the hosted zone via the AWS Console or CLI if it is actively routing internet traffic to avoid outages or DNS failures.

πŸ›‘οΈ Notes​

This is a Level 1 foundational networking module. To activate the zone, update your domain registrar’s NS records using the zone_name_servers output provided by this module.

πŸ”’ Deployment Package Notice​

This module is part of the Level 1 AWS License Tier. To access the full deployment package and source code, subscribe to Archiphire.