How to internet - Domains & DNS, Hosting, The Cloud™, & Serverless. [The Web Explained: Part 7]

How to internet - Domains & DNS, Hosting, The Cloud™, & Serverless. [The Web Explained: Part 7]

March 15, 2021 | 🕐8 Min Reading Time

The last section around backend technologies covered a lot of ground. I hope you've had time to let it soak in like a nice marinade, review your notes, and Tweet about how wrong I am about your favorite thing. I will do my best to keep this section a little tighter and tighter for the sake of your attention span and the impending carpal-tunnel syndrome that writing this collection of articles has placed me into the unholy crosshairs of.


🙊 Domain Names & DNS

The Domain Name System (DNS) is basically like a big phonebook/contact list for the internet. We don't generally remember most people's numbers; we instead look them up by name in our phone. When you enter a domain name (kaseysludicrousburgers.com), DNS translates it into the actual IP Address of the server that hosts that web application. There are a few more technical steps involved, but that's the gist of it.

Isn't this way easier than asking people to visit your website at http://172.217.12.14?

Overview of DNS. Credit: https://www.wpbeginner.com


🛒 Registering a Domain

To stake your claim on the internet, you need to register your domain name with a registrar accredited by a top-level-domain registry.

This means that a handful of companies have been given clearance to sell domain names to the public and those domain purchases, while made with the registrar, ultimately end up in the database of the central registries.

If you wish to register a domain, you can head over to any of the popular registrars (Godaddy, NameCheap.com, Domain.com, etc.) and begin searching to see if one is available. If available, the process is quite simple (and cheap), and within minutes, you could be the owner of your own piece of internet real estate.


🤝 Transferring a Domain

There will likely be instances where a domain that you would like is currently registered by someone else. In that case, you have a few options:

  • Wait for the domain to expire (you can look up this information here) and hope the person who registered it didn't notice. Highly unlikely. But, it happens.
  • You can reach out to the contact on record (from your Whois search above) and see if they will sell it to you. In which case, you can initiate a domain name transfer. It is common to use an escrow service to protect both parties and ensure both payment and release of the domain.
  • Work with a domain broker to try and broker a sale. This can be advantageous if you're looking to protect your anonymity and would like to ensure that the potential sale is made at a fair value and with as few hiccups as possible.

🧠Learn more about Domains & DNS:


https://www.cloudflare.com/learning/dns/what-is-dns/
https://www.pcmag.com/news/how-to-register-a-domain-name-for-your-website
https://www.forbes.com/sites/forbestechcouncil/2019/04/17/how-to-find-a-great-domain-name-broker/?sh=2f72f0c772d2


🏟 Hosting

So, you've found the perfect domain for your next unicorn tech startup, but you've realized that you now have a new problem to solve: where in the hell will this new web app live? Remember how we said that DNS essentially translates domain names to an IP Address?

Well, that IP Address is basically the unique number for the computer connected to the internet that will host your web application. When a user types in your domain name or clicks a link to it, the webserver at that particular IP Address knows to serve up your website every time someone enters in with your domain name.

Obviously, what type of hosting you choose is significant. You need to consider everything from cost (especially if this website gets huge) to features (can this scale with me?) and availability (what guarantees do they have around uptime?). There are a vast number of options out there in the wild wild web, but it's never been easier (or cheaper) to host your next big idea.


🏘 Shared Hosting

This is how most of us got our start. A shared host is basically one piece of physical hardware that hosts multiple websites or applications. This is pretty economical and will cost you a few bucks a month. Shared hosts are like living in an apartment or townhome, with neighbors you don't choose, who throw wild parties you aren't invited to.

Shared Hosting Advantages

  • Cheap (a cup of coffee from a gas station cheap).
  • You get some basic tools to make things "easier" to setup.
  • It's like living in a townhome; all the maintenance is included.

Shared Hosting Disadvantages

  • Not the most performant.
  • You don't choose your neighbors. While it is unlikely, their misdeeds could cause performance or security risks to your website.
  • Much fewer customization options from a hosting perspective.

🏠 Dedicated Hosting

Some businesses choose to go the route of dedicated hosting. With this model, you pay more money but get ultimate flexibility. You can even choose what operating system the host is running. You are leasing a server from a company, and no one else can use any part of it. This is like renting a home. You may not own it, but you have a pretty damn good expectation that you're not going to come home and find another family using your toothbrushes.

Within dedicated hosting, you can generally choose managed or unmanaged servers. With unmanaged servers, complete control is afforded to you, along with complete responsibility. Managed servers are great options for businesses that don't want to deal with daily server maintenance tasks like security updates, monitoring, etc. This white-glove service will cost you additional cash-money, as to be expected.

Dedicated Hosting Advantages

  • Complete control.
  • No shared resources.
  • The performance your app requires.
  • Your unique security and compliance needs can be met.

Dedicated Hosting Disadvantages

  • Much more expensive, often the most expensive option
  • If you go unmanaged, it will require some technical expertise

☁️ The Cloud™

At a previous company I worked for, we had what you could call "some scheduled downtime" of our entire infrastructure. This downtime would last approximately 6 hours. The cause of said downtime? Simply, our dedicated servers were hosted in a data center somewhere in the Bay Area of California, and this particular data center provider had to move locations quickly due to some real-estate-lease-funkiness. Ok, no big deal...right? Well, just imagine your entire company's infrastructure, the data for millions of users, and software for hundreds of large customers...rolling down the 101 in California during rush hour traffic on a flatbed truck. The entirety of the 75-person company was simultaneously holding its breath and saying a litany of prayers to the Archangel Michael for the safe passage of our precious cargo.

That should do the trick.


In the words of every infomercial I've ever seen...there has to be a better way.


Because engineers are amazing, there exists a third option that balances cost, reliability, maintenance, security, and scale in a way that has pretty much become the de-facto standard of how a large number of companies run their infrastructure. This, my well-traveled friend, is The Cloud.

Queue the dramatic music.

Speaking in broad generalities, the cloud is really an easy way to say "any software or services that run on the internet instead of on your local computer." I remember seeing a sticker somewhere that says, "there is no cloud, it's just someone else's computer," which almost hints at a layer of distrust with anything cloud-based, which you really shouldn't have.

The major players in the space are most definitely Amazon (AWS), Microsoft (Azure), and Google (Google Cloud Platform). The first of these, and arguably the most widely-used, is the vast and frankly mind-boggling number of services made available by Amazon. Since 2006, Amazon's cloud services have been used and abused by Netflix, LinkedIn, Facebook, Twitter, and Twitch, to name but a few of the biggest players. Ultimately, AWS is used by enough companies large and small that its various offerings made up over 63% of the entire company's operating profits in 2020. That's $13.5 billion in profit if you're playing the at-home game.

So what does this practically mean for you, the random person who's just trying to get their next application deployed somewhere so millions of people can use it? Well, it helps to understand how things like AWS got their start.

Essentially, the company realized that they needed efficient ways to scale up Amazon's gigantic infrastructure and quickly saw opportunity to sell this capability as a service to others outside of the company. The team had no idea it would be this wildly successful, seeing it as something fun and interesting to try, but its impact has shaped the way modern applications are built thanks to the key services contained under the AWS umbrella.

As of 2020, AWS comprises over 175 different services, including the ability to have a friggin' semi-truck with a 45-foot shipping container show up at your office so you can transfer Exabytes of data (It appears this operation is a bit more put together than Uncle Rico's Flatbed Rental Service that transported our dedicated servers down the 101).

But let's just stick to the top 5 common services for now...we can figure out how to plug into the big-rig semi-trailer later...


EC2: Host the things you'd normally serve on a computer somewhere.

logo ec2

Remember dedicated servers from before? This is is kinda like that. But rather than being a dedicated piece of hardware, you get a dedicated virtual piece of hardware. You can choose the size of your *virtual machines,* which of course increases cost with various increases in various performance metrics. In the world of computing, there are various types of work to be done, some requiring more memory, some requiring a faster processor, while others require raw disk space to operate. With EC2 (Elastic Compute Cloud), you can choose the right weapon for the job, and the real game-changer for almost every AWS service is that you only pay for when it's being used. ****Compare this with the cost of a dedicated server, and the savings start to become very compelling.


S3: It's a place to put your stuff.

logo s3

S3 (Simple Storage Service) is a place to dump your static files like images, PDFs, or user uploads. It's very fast, very stable (you wont lose your files), and very very cheap (currently at about $0.023 per Gigabyte of data, per month).


Cloudfront: Get closer to your users. Like physically closer.

logo cloudfront

The internet is still bound by most of the laws of physics. Even at light-speed, it still matters to be closer in proximity to something. For this reason, Amazon and other cloud players have data centers located around the globe that ensure that if I'm in Poughkeepsie, I'm not waiting for every request to return from a server in Bangladesh. The concept of geo-distributing servers around the globe is referred to often as a CDN, or Content Delivery Network, and is an essential part to a high-functioning and performant internet.


RDS: It's your database server for MySQL or PostgreSQL.

logo rds

Need a relational database? Cool. Click a few buttons, and you've got one from Uncle Amazon on the cheap. Like everything, you can configure this server to your requirements, paying as you go.


DynamoDB: It's your NoSQL server.

logo dynamo

Remember when we talked about the document and key-value stores called NoSQL? Want one? Give Amazon more of your money. Click maybe like 3 buttons. Boom. You've got one.


✨ Serverless

One quick thing to touch on is the fairly-recent concept of serverless technologies, such as AWS Lambda. The term serverless can be a bit of a misnomer, as there's totally servers behind it all, but from a developer standpoint, you really don't need to worry about the server.

Most services charge you nominal fees by the literal milliseconds that your application is running. With a solution like AWS Lambda, you can write code that waits to be executed until called, and only when it is called are you charged. Because of the functional nature of many of these services, a subset of them are often called Functions as a Service (FaaS). This means that you often have a series of small functions that are triggered by events (API calls, for example) that execute a singular or limited number of tasks in response.

If your Lambda function needs to connect to a database, insert those records, and then do 20 other things, it'll likely take longer than a simple function that just returns the burger of the day. This will cost more, but not much. If no one hits that service for 5 days, you will owe nothing. If Reddit features your site, and you get 1 million new users, you don't have to worry about scaling; it'll happen automatically. This is the magic and beauty of serverless - the ability to be pretty much free to start while allowing for plenty of room to grow to even the largest amounts of traffic.

🧠 Learn more about Serverless:


https://www.cloudflare.com/learning/serverless/what-is-serverless/
https://aws.amazon.com/serverless/


🌥 The Cloud: TLDR;

From previous sections, we should have a mental model of frameworks as Lego blocks that enable you to assemble your ideal creation. The cloud is a collection of services that exist to do quite the same. You could consider the many cloud offerings to be a framework of sorts that helps abstract away the nuances of running infrastructure in the same way that a CSS framework saves you from dealing with strange browser quirks. This saves you time and money and lets you focus on what you really want to be doing, which likely isn't upgrading blade servers in a data center somewhere.

🧠 Learn more about AWS:


What is AWS?
https://expeditedsecurity.com/aws-in-plain-english/
https://news.ycombinator.com/item?id=23309269