Skip to content

DNS

All applications in a environment will be deployed to a subdomain of oslo.systems.

The default domain for your environment set up by this guide is: {Environment}.oslo.systems, subsequent applications will be set up as subdomains of this domain.

Step 1: Create a new configuration file

Create a new configuration file for DNS:

repo-iac/environments/dev/_config/dns.yml
StackName: "dns"

Step 2: Add and install the dns package

Run the following command in the repo-iac/environments/dev/ directory:

repo-iac/environments/dev/
ok pkg add dns

This will add the package you want to install to packages.yml. If you want to know more about how this works, read the reference documentation for packages.yml.

Then, run the following command to install the package:

repo-iac/environments/dev/
ok pkg install dns

Step 3: Initialize and apply the dns stack

repo-iac/environments/dev/dns
cd dns/
terraform init
terraform apply

Once terraform applycompletes, a list of name servers will be printed to the console.

Output from terraform apply
name_servers = tolist([
  "ns-123.awsdns-44.org",
  "ns-321.awsdns-29.co.uk",
  "ns-213.awsdns-35.com",
  "ns-231.awsdns-18.net",
])

Step 4: Verify

Verify in the AWS CLI

Run the following command:

aws route53 list-hosted-zones | jq '.HostedZones[].Name'

The output list should contain the name of the domain you just created.

Verify in the AWS console

Login to the AWS console and navigate to Route 53. Select Hosted zones in the left-hand menu.

The hosted zone list should contain the name of the domain you just created.

Step 5: Add DNS Name Servers

The output from Step 3 are the name servers for the root domain specified in _gp_dns.tf. Because oslo.systems was specified as the root domain, follow the guide Adding a subdomain to oslo.systems to complete the setup.

To override the default configuration you can set the root_domain variable in dns/config_override.tf to the desired value.

The domain pirates-dev.oslo.systems should now resolve to the application or applications you deploy in the next steps of the guide.

Step 6: Verify

To verify that the subdomain is properly registered with a name server (after the guide in step 5 have been completed):

dig NS +short {Environment}.oslo.systems

This should give you a list of name servers corresponding to the list printed after the terraform apply command in step 3.

If you don't have dig installed, use this DNS lookup tool to check {your-subdomain}.oslo.systems.

Commit your files

At this stage it is a good idea to commit your files.

Next step

Set up networking.