Can't read this? Access the online version of our newsletter!
Hi Reader 👋🏽,
We hope that everything's alright on your side - maybe you're already heading into the vacation or you're just enjoying the weather - which is hopefully not too hot! 🏝️
This week we want to talk about Amazon Route 53 📌
For understanding what Route 53 is and how to work with it, we'll go through the fundamentals of the worldwide DNS first. Then we'll talk about Route 53's capabilities and why it's more than just a simple resolver.
This includes a look at all of its simple and advanced routing policies and more great features like health checks that can be tied to your records!
Before diving into this, we'd like to drop you a wrap-up in the form of an infographic ↓
Naming is crucial in distributed systems for identifying entities.
The internet's DNS provides...
A common example to visualize this is to think of it as a phone book for the internet. If you want to call somebody, you need some kind of directory that helps you find their number. 📞
DNS management has a unique feature of decentralized control, allowing high scalability and avoiding a single point of failure.
It has a hierarchical structure maintained by registries in different countries, with authoritative name servers at the top holding actual addresses for DNS records, followed by top-level domain servers, root name servers, and recursors as we go down.
When resolving domain names, we need to distinguish between two types of services:
What's caching and why it would be impossible to provide DNS on a global scale without it?
Caching is the process of saving information for a short period to reduce the load on up or downstream systems that are part of a request.
Caching is crucial to keep the internet’s DNS resolvers healthy. 🏥
There are different locations where caching takes place. The two most obvious of those caching locations are
The closer the caching is to your browser, the better, as it reduces the number of required processing steps, often through different systems.
Now that we understand how DNS works, let's explore Amazon Route 53! 📌
A hosted zone acts as a container for several records that specify how traffic should be routed for the root domain and its subdomains. Hosted zones come in two different flavors: public and private.
You can use Route 53 to route traffic to various AWS services, including:
There are different types of routing that you can use for your domain names. Let’s dive into those policies in the paragraph.
The type determines how Amazon Route 53 responds to queries for those domain names. The selection of the best-fitting record types highly depends on your requirements.
The standard DNS record for a single resource.
No multiple records with the same name are allowed.
Specify multiple values for one record. Route53 returns all values and the client selects one by himself.
You can define multiple records for the same domain name using it and control the traffic distribution among them by assigning a percentage, as the name suggests.
Prominent use cases are load balancing and testing new features or releases.
Weighted routing not only enables you to quickly scale your application but also build blue/green deployments or do traffic shifting that is fully in your control.
In a multi-region setup with latency-based routing, if the nearest region for a customer is unavailable, we should avoid routing requests to that region. 🔥
That’s where health checks come in. Health checks in Route 53 allow you to monitor the availability of AWS-native or external endpoints.
Those checks are configurable:
The exciting part: You can attach the health checks to your Latency-based records. If a location's health check becomes unhealthy, the corresponding target will no longer be propagated for that DNS record.
In a multi-region setup, you want to route requests to the closest region for faster responses.
With Latency-based routing, create multiple records for a domain, each for a specific region. When queried, Route 53 chooses the record with the lowest latency.
Geo-Location records allow routing based on the origin of your clients. This enables you to easily localize content or implement geo-restrictions to comply with regulations.
The granularity of locations is either by continent, country, or even US state.
For serverless architectures, deploying your eco-system globally won’t increase your costs significantly. Unused resources don’t contribute to your bill, so adding more regions won’t affect your charges.
To build a multi-region setup with Route 53, follow these steps:
If all regions are healthy, requests go to the region with the lowest latency. Even if a region has little or no traffic, it won’t affect anything.
In case of a regional outage or accidental application breakage due to a faulty deployment, Route 53 quickly fails over. It won't return the unresponsive region for any DNS query, preventing significant outages.
This may cause slower requests for origins with long distances, but it only affects the application's availability for a brief period.
Canary deployments roll out new app versions to a small user group first to avoid deploying errors to many users. This allows checking for issues before a wider rollout.
Jumping into Networking fundamentals: Services like ALB can route traffic based on headers or cookies, so you can send specific users to a dedicated deployment.
The ALB will terminate the TLS connection. The downstream service, such as an ECS task, communicates with the ALB over a separate HTTP or HTTPS connection, depending on the configuration of the ALB.
Some architectures can't support simple traffic routing, such as those needing secure connections to the application container.
For example, if a TLS connection is terminated within the container (e.g. with an NGINX container) in an ECS cluster, you need to use an ELB instead of an ALB.
ELB works on the transport layer and doesn't terminate the TLS connection, forwarding the request as is. This ensures end-to-end encryption from the client to the application, increasing security.
⚡️ The obvious downside and problem: For HTTPS requests, services in between (including ELB) can't inspect request details to make routing decisions. Instead, we can set weights on target groups to route traffic percentages to each group.
In serverless architectures, we use AWS API Gateway instead of load balancers to route requests to different Lambda function versions.
Setting up routing to different function versions can be challenging if the infrastructure is coupled with the function code. However, with serverless architectures, we can replicate infrastructure without worrying about costs.
To delegate routing decisions to Route 53, use records for weighted routing and run multiple stacks for multiple replications of the application.
Deploy multiple stacks of the application infrastructure, including AWS API Gateway and Lambda function. Another global infrastructure (e.g. SQS and DynamoDB) is independent of the application stack.
Each regional API gateway gets a weighted DNS record, with the inactive stack set to weight zero and the active one set to 100.
To roll out a new code deployment, deploy the inactive stack first. Once completed, adjust weights in the DNS record.
For example, set the new version stack to receive 20% of the traffic while the old one keeps 80%.
After we’ve run this configuration for a while and made sure there are no error spikes or other suspicious behavior in our application, we can switch the rest of the traffic to the new version.
Route 53 has very transparent pricing.
What you'll be charged for is simple:
You don't have to worry about anything when starting to use Route 53.
That's it for Amazon Route 53 and for today.
We hope that you've learned something new and you're excited to use Route 53 for yourself! 📚
Have a great week ⭐️
Sandro & Tobi
If you're interested in more, have a look at our
AWS Fundamentals blog 📚
We teach AWS for the real world - not for certifications. Join more than 10,500 developers learning how to build real-world applications on AWS.
AWS FOR THE REAL WORLD ⏱️ Reading time: 15 minutes 🎯 Main Learning: How to build an automated related posts feature by leveraging Bedrock Knowledge Bases and Amazon S3 Vectors for content discovery. 📝 Blog Post Hey Reader 👋🏽Ever wanted to show folks “related posts” but didn’t want to build your own search from scratch? We’ve been playing with Bedrock Knowledgebases and S3 vectors, and turns out, it makes that job way easier than expected.We’ll go over how you can use these tools to connect...
AWS FOR THE REAL WORLD ⏱️ Reading time: 8 minutes 🎯 Main Learning: How to automatically generate professional AWS architecture diagrams using Amazon Q with MCP servers 📝 Blog Post Hey Reader 👋🏽Let’s talk about saving money on AWS. Cost surprises are no fun—especially for folks just starting out. AWS pricing looks easy at first, but there are so many little things that can trip you up if you’re not careful.Today I’m breaking down a few simple tips that actually work for beginners. Let’s jump...
AWS FOR THE REAL WORLD ⏱️ Reading time: 8 minutes 🎯 Main Learning: How to automatically generate professional AWS architecture diagrams using Amazon Q with MCP servers 📝 Blog Post Hey Reader 👋🏽Ever tried drawing an AWS architecture diagram and ended up spending hours just lining up boxes? Yeah, same here. That’s why I’m pretty pumped about Amazon Q’s new diagram feature. You just describe your stack, and—boom—instant architecture diagram. It’s wild how much time this might save.Let’s take a...