AWS Builder Center
I Typed a URL. How Did It Find My App?

I Typed a URL. How Did It Find My App?

My app lived behind a long, forgettable load balancer address and loaded slowly for friends overseas. Here's what actually happens when you type a URL, and how Route 53, CloudFront and free HTTPS certificates gave my app a real name and a faster path to users.

AI Developer
In my last post, my app finally stopped depending on one server. An Application Load Balancer sent users to healthy servers, and Auto Scaling added, removed, and replaced them on its own.
My app could survive a failure now.
But there was one embarrassing problem left. To visit it, people had to type something like this:
my-app-alb-1234567890.ap-south-1.elb.amazonaws.com
Nobody was going to remember that.
And when a friend abroad tried it, she said the pages felt slow. My servers were in Mumbai. She was on the other side of the world.
So I had two questions:
  1. How do I give my app a real name?
  1. How do I make it fast for everyone, not just people near my Region?
And under both of them was a question I'd never actually thought about: what really happens when you type a URL?



Computers Don't Understand Names

This was the first thing I had to accept.
When I type  example.com , my computer can't connect to a name. It needs an IP address.
The system that translates names into addresses is DNS (Domain Name System). People often call it the phonebook of the internet.

So, What Actually Happens When I Type a URL?

Here's the journey, simplified:
  1. My browser checks if it already knows the address (from its cache).
  1. If not, it asks a DNS resolver, usually run by my internet provider.
  1. The resolver asks a root name server: "Who handles  .com ?"
  1. The root points it to the  .com  TLD name server: "Who handles  example.com ?"
  1. That points it to the authoritative name server for my domain, which finally answers with the address.
  1. The resolver caches the answer for a while and hands it back to my browser.
All of that usually happens in milliseconds, before the page even starts loading.
Before your browser loads a single byte of a page, DNS has already had a conversation with several servers around the world.



Part 1: Route 53, Giving My App a Real Name

Amazon Route 53 is AWS's DNS service. (The name comes from port 53, the port DNS uses. I loved learning that.)
It can be the authoritative name server in step 5 for my domain.

The Pieces I Had to Understand

1. Domain: the name itself
I registered a domain. You can register it through Route 53 or use one from another registrar.
2. Hosted zone: where my DNS records live
A hosted zone is a container for all the DNS records of one domain. When I registered my domain, Route 53 created a public hosted zone for it automatically.
3. Records: the actual answers
Each record answers one kind of question:
Record
What it means
A
This name points to an IPv4 address
AAAA
This name points to an IPv6 address
CNAME
This name is another name for a different domain name
MX
Where to deliver email for this domain
TXT
Text values, often used to prove you own the domain
4. Alias records: the AWS-specific shortcut
This was the part that solved my problem.
My load balancer doesn't have one fixed IP address. Its IPs can change. So I couldn't just create an A record with an IP.
Route 53 has alias records, which point a name directly to an AWS resource, like my load balancer. Route 53 keeps track of the resource's current addresses for me.
Two things made them even better:
  • They work at the root of the domain ( example.com ), where a CNAME isn't allowed.
  • Alias queries to AWS resources like load balancers aren't charged.
I created an alias record pointing my domain to my ALB. A few minutes later, my app had a real name.
An IP address can change. A name you control, pointing to the right place, doesn't have to.

More Than a Phonebook

Route 53 can also make smarter routing decisions with routing policies:
  • Simple: one answer
  • Weighted: split traffic, like 90% to the current version and 10% to a new one
  • Latency-based: send users to the Region that responds fastest for them
  • Failover: use a backup when health checks say the main one is down
I only needed simple routing for now. But it was interesting to see that DNS can play a part in availability too.



Part 2: HTTPS, Because a Real Name Deserves a Padlock

With a real domain, my browser showed "Not secure" next to it. My app was using plain HTTP.
AWS Certificate Manager (ACM) fixed that. It gives you free public SSL/TLS certificates to use with AWS services like load balancers and CloudFront, and it renews them automatically.
To prove I owned the domain, ACM asked me to add a DNS validation record. Since my domain was in Route 53, the console offered to add it for me with one click.
A few minutes later: padlock. 🔒
One detail that tripped me up: a certificate for CloudFront must be requested in the US East (N. Virginia) Region,  us-east-1 , even if your app runs somewhere else.



Part 3: CloudFront, Bringing My App Closer to Users

Now for the speed problem.
My friend's request was travelling from her country all the way to my servers in Mumbai, then all the way back. Every image, every script, every time.
Amazon CloudFront is AWS's CDN (Content Delivery Network). It caches content at edge locations, which are hundreds of data centres around the world, close to where users actually are.

How It Works

  • The first time someone near an edge location asks for a file, CloudFront fetches it from my origin (my ALB or S3 bucket). That's a cache miss.
  • It keeps a copy at that edge location.
  • The next person nearby gets it straight from the edge. That's a cache hit, and it's much faster.
A CDN doesn't make your servers faster. It makes the distance shorter.

The Pieces I Set Up

  • Origins: where the real content lives. I used two: my S3 bucket for images and my ALB for the app.
  • Cache behaviours: rules based on the URL path.  /images/*  comes from S3 and gets cached for a long time.  /api/*  goes to my ALB and isn't cached, because it's different for each user.
  • TTL (time to live): how long a cached copy stays at the edge before CloudFront checks for a newer one.
  • Invalidation: when I update a file and can't wait for the TTL, I can tell CloudFront to clear it.

And It Connected Back to S3

Remember my S3 post, where I learned S3 is private by default?
I didn't have to make my bucket public for CloudFront. Using Origin Access Control (OAC), the bucket only allows reads that come through CloudFront. Users get fast images, and the bucket stays private.
The same lesson keeps coming back in this series:
Being available and being securely available are two different things.
CloudFront also comes with AWS Shield Standard protection against common network attacks at no extra cost. That was a nice bonus I didn't know about.



How It All Fits Together Now

Here's the path a request takes in my app today:
  1. A user types my domain.
  1. Route 53 answers the DNS question and points it to CloudFront.
  1. CloudFront serves cached content from the nearest edge location, over HTTPS with an ACM certificate.
  1. Anything not cached goes to my ALB (or S3 for images).
  1. The ALB sends it to a healthy EC2 instance in my Auto Scaling group.
  1. That instance uses an IAM role and talks to RDS in a private subnet.
Seven posts ago, I clicked "Launch Instance." Now I can trace a request from someone's keyboard all the way to my database.



What DNS and CDNs Taught Me Beyond DNS and CDNs

Before this, I thought of "the internet" as a straight line between a user and my server.
Now I see it's more like a set of handoffs: resolvers, name servers, edge locations, load balancers, and servers, each doing one job well.
It also changed how I think about performance. I used to think speed meant bigger servers. Often it means shorter distances and not doing the same work twice.



My Takeaway

When I typed my URL, my browser didn't magically find my app.
DNS turned a name into an address. Route 53 gave my app a name I control. ACM gave it HTTPS for free. And CloudFront brought it closer to users, wherever they are.
The question changed from "Does my app work?" to "Can people find it, trust it, and reach it quickly from anywhere?"
But one thing still bugs me. My servers run all day and all night, even when nobody is using my app. Next, I'm exploring what happens when code runs only when it's needed: AWS Lambda and API Gateway, and what "serverless" actually means.
Stay tuned! 🚀
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article