💻Common Interview Question: What Happens When You Type An URL?


Hello Reader,

One of the most popular interview question is what happens when you type an URL? Let's find out. So obviously when you type in URL like www.amazon.com, you see the website in your computer or your mobile phone. The interviewer wants to know what happens under the hood so that you can see this website.

Core Concept

At the end of the day, everything is a computer to computer interaction. So in a very rudimentary level, amazon.com is running on bunch of Amazon EC2s. Those EC2s are exposed by Elastic Load Balancer service, and the DNS name amazon.com is hosted in Amazon Route 53. And there is an alias record where amazon.com is pointing to an Elastic Load Balancer.

For your computer to interact with this load balancer. You need the IP address of the load balancer. So the core of this question is how does when you type amazon.com, your computer gets the IP address of this load balancer. With this knowledge in mind, let's go through the steps:

Step 1 : You type amazon.com in the browser

Step 2 : First, your computer check the cache if you have the IP address already saved. First, it checks in your browser cache. If it is not found there, it checks the operating system cache. If it is not found there, it checks the router in your home and if it is not found there, it goes to your internet service provider cache.

Let's say the IP address is not found for amazon.com in any of those cache. Then it goes to DNS resolver. This DNS resolver is typically managed by your internet service provider, such as a cable internet provider, DSL broadband provider, or a corporate network. If you are typing this on your office laptop, this DNS resolver does a recursive DNS lookup and asks multiple DNS servers around the internet, which in turn asks more DNS servers for the DNS record until it is found. This part is confusing, so let's take a deeper look.

Step 3 : Your DNS resolver checks with the DNS root name server by asking "hey, do you have the IP address for amazon.com?". This DNS root name server says "I do not have the IP address for amazon.com, but I am going to give you the name server which has the IP address for all the .com domains".

So once DNS resolver gets the name server for .com, it goes to that nameserver for .com TLD or top level domain. This name server tracks what DNS provider has amazon.com. So it says "I don't have the IP address for amazon.com, but I have the Amazon Route 53 Nameserver that is hosting this amazon.com". So DNS resolver, after getting the address of this Amazon Route 53 goes and asks Amazon Route 53 "Hey, do you have the IP address for Amazon.com?".

And since amazon.com is hosted on Route 53, it sends the IP address of the load balancer. And at this point, DNS resolver sends IP address to your computer. Also, it caches this IP address in the DNS resolver. So next time someone comes for amazon.com, it doesn't have to go through all these recursive DNS queries and can directly return to the user.

Now, in this case, we assume that amazon.com is hosted on Amazon Route 53. But even if that's not the case, let's say your URL is hosted on GoDaddy or another DNS hosting server. This DNS recursive lookup by DNS resolver will finally go to that DNS hosting server and get the IP address for the server or the URL you are looking for.

All right. Going back to the flow now!

Step 4 : Your computer now knows the IP address to which it needs to go. So your computer invokes that IP address which ends up in the elastic load balancer that's distributing traffic to the Amazon EC2 servers.

Step 5 and 6 : And in return it sends the HTML, CSS, and JS content to your laptop and your laptop renders the web page for Amazon.com. If you open up developer settings on the browser, you will see when you type amazon.com; it returns a bunch of HTML, CSS, JavaScript, etc. All these are coming from the web servers (EC2s) running amazon.com.

Now you know how the websites are displayed when you type in a URL. All right guys and gals, this is a very, very important interview question. Please understand the flow! And then you are all set to go for the interview 🙌🚀.

If you have found this newsletter helpful, and want to support me 🙏:

Checkout my bestselling courses on AWS, System Design, Kubernetes, DevOps, and more: Max discounted links

AWS SA Bootcamp with Live Classes, Mock Interviews, Hands-On, Resume Improvement and more: https://www.sabootcamp.com/

Keep learning and keep rocking 🚀,

Raj

Fast Track To Cloud

Free Cloud Interview Guide to crush your next interview. Plus, real-world answers for cloud interviews, and system design from a top Solutions Architect at AWS.

Read more from Fast Track To Cloud

Hello Reader, Another day, another MCP tool. But this one is special. Today we are going to go over newly released EKS MCP server. This is the official Kubernetes MCP server released and maintained by AWS. This one will rule them all! In today's edition, we are going to go over what it is, why this one is a game changer, how you can use this to get job interviews and demand more money, and whether it will eliminate SRE jobs. There are three Ways to Manage Kubernetes : Traditional Way (Manual...

Hello Reader, We all heard it - Gen AI is taking away your job. The reality is, it is for sure impacting your job functionalities. However, there is a bigger reason why many folks are failing interviews and not growing in their career, due to Gen AI, but NOT for the reasons you think! Let's dive deep You're Learning the Wrong Gen AI Tools ⚙ There are countless Gen AI tools and services out there. But here’s the key question you should be asking: Which tools are actually being used by the...

Hello Reader, MCP is all the rage now. But does this make RAG obsolete? This is becoming a burning question in real-world projects and in interviews. In today's edition, let's take a closer look and find out the answer. Let's go over what is what quickly. RAG (Retrieval Augmented Generation) RAG (Retrieval Augmented Generation) is used where the response can be made better by using company specific context that the LLM does NOT have. You store relevant company data into a vector database....