DEV Community

Cover image for AWS Route 53 with Terraform
Augusto Valdivia for AWS Community Builders

Posted on • Updated on • Originally published at

AWS Route 53 with Terraform

In this article we will imagine that your team received two very important pieces of information. The first being about issues regarding the company website and the second being about the future of your company.

First, the Social media team has revealed to your team that a significant proportion of your customer base are leaving bad reviews about the stability of your website. Customers describe that the website has been down frequently during the past month on different days of the week and at random times during the day.

Secondly and part of the good news is that the company started looking into moving their online business from their on-premise environment to a public cloud provider.

For this project the company’s main requirements are:

  • Scalable cloud Domain Name System (DNS) webserver
  • Very reliable
  • Highly available
  • Cost effective

Your team received the task to conduct research on the three big public cloud providers on the market and to create a presentation with the best options for this migration. Your manager has given you the task to provide details about Amazon Website Services (AWS) DNS server and to present a proof of concept (POC) in front of your company directors to provide a representation of what this infrastructure would look like in the cloud.

Research stage

As your research advances you discover that AWS-Route53 provides the following functions:

  • Domain registration
  • DNS service
  • Health checking -Private DNS resolution within VPC’s using private hosted zone

Looking promising already – right?

Development stage

Looking at the research stage looks like AWS-Route53 has great components that could help with company requirements.

How can AWS-Route53 could help us with our issue?

Health checking is a great feature that AWS-Route53 uses to send automated requests over the internet to applications verifying that it is working, accessible and available. In addition, AWS-Route53 has different policies that can be used under different circumstances.

Types of policies:

  • Routing policies
  • Simple routing policy
  • Weighted routing policy
  • Latency based routing policy
  • Failover routing policy
  • Geolocation routing policy

In this stage you will focus on building and deploying the following AWS-services:

  • Availability zone
  • VPC
  • Public subnet
  • Internet gateway
  • Route table
  • EC2
  • Security groups
  • Elastic Ip
  • Route 53
  • S3 bucket

For readability some services are not included on this diagram: AWS-Route 53 Failover routing policy

Alt Text

Alt Text


On the day of your presentation, you will be able to showcase a full AWS-Route53 Failover routing policy demo where a primary record, the EC2 instance, will automatically switch over to a secondary backup record, an S3 bucket, after the primary indicated a failure on the AWS-Route53 health check. And because you are all about code you will be using Terraform to provision this deployment.

"Everything fails, all the time"

AWS CTO, Werner Vogels

And servers that host websites are no exception. Servers and systems can fail for several reasons. However, having backup plans ensures that when such problems occur users of the application do not experience any downtime.

Note to be able to complete this project you will need a domain.

Functions, arguments and expressions of Terraform that were used in the above project:

types and values

Find the Terraform repo and directions for this project here

Top comments (0)