Skip to main content

Creating a Route 53 Hosted Zone


This short guide will run through the process of creating a Route 53 Hosted Zone through Terraform for your environment.


This guide assumes you have an environment already created in the Live cluster and defined in the cloud-platform-environments repository. If you have a service running on a * URL, then you are on the Live cluster already.

Terraform files

Copy the Terraform resource code below and save it into the respective 3 files in the [your namespace]/resources directory in the cloud-platform-environments repository:


terraform {
  backend "s3" {}

provider "aws" {
  region = "eu-west-2"

Note: If you already have that file defined in your environment, do not recreate it.

This file declares the variables fields utilised in the file below
Fill in the variables below with your settings. Fill namespace field below with your existing kubernetes namespace, all the example fields below with desired values (all lowercase, and no spaces), and the domain variable with your desired URL (pay special attention if your URL contains “justice” or not).

variable "namespace" {

variable "business-unit" {
  default = "example-bu"

variable "team_name" {
  default = "example-team-name"

variable "application" {
  default = "example-app"

variable "environment-name" {
  default = "dev"

variable "is-production" {
  default = "false"

variable "infrastructure-support" {
  default     = ""

variable "owner" {
  default     = "example-owner"

variable "domain" {
  default = "YOURDOMAIN.service.(justice)"

Note: If you already have that file defined in your environment, do not recreate it, but make sure that all the variables mentioned above are included, for example, the domain

Make sure to replace the placeholders and example values below with relevant ones. If you are referring from variables in, use var.VARIABLE NAME, so for example, the “domain” variable defined in can be referenced as var.domain.

Note: Please follow the convention on when to use _ vs -.

resource "aws_route53_zone" "example_team_route53_zone" {
  name = var.domain

  tags = {
    team_name              = var.team_name
    business-unit          = var.business_unit
    application            = var.application
    is-production          = var.is_production
    environment-name       = var.environment
    owner                  = var.github_owner
    infrastructure_support = var.infrastructure_support
    namespace              = var.namespace

resource "kubernetes_secret" "example_route53_zone_sec" {
  metadata {
    name      = "example-route53-zone-output"
    namespace = var.namespace

  data = {
    zone_id   = aws_route53_zone.example_team_route53_zone.zone_id

Creating the resource

Commit your changes to a new branch and raise a pull request. Once approved, you can merge and the changes will be applied. Shortly after, to confirm the zone has been created, you should be able to access the Zone_ID as Secret on kubernetes in your namespace.

Support ticket

Please raise a support ticket with the Cloud Platform.

Provide them with the domain name, the Cloud Platform team will finalize the process by creating a matching NS record in the DSD account.

Add DNS records to a route53 zone

You can add DNS records for the zone you created, using the aws_route53_record terraform resource.

Example below, will add a record set of type “CNAME” to the route53 zone.

resource "aws_route53_record" "add_cname_email" {
  zone_id = aws_route53_zone.example_team_route53_zone.zone_id
  type    = "CNAME"
  records = [""]
  ttl     = "300"

Follow the example-usage, to create different type of record sets, using aws_route53_record resource.

This page was last reviewed on 14 September 2023. It needs to be reviewed again on 14 December 2023 by the page owner #cloud-platform .
This page was set to be reviewed before 14 December 2023 by the page owner #cloud-platform. This might mean the content is out of date.