This is what happens when you click on alejandro.tech
Route 53 routes your request to the HTML, CSS and JS files which live inside a S3 storage bucket. These are cached by Cloudfront. That means there's **a copy of them across 200+ locations around **the world. So no matter if you connect from Singapore or France, you'll get the content as fast as possible.
Remember, the internet is a bunch of physically connected computers exchanging information at (close to) the speed of light. Being closer to the information you want, means faster loading times.
Click here if you want to know what's the nearest AWS location to you.
Meanwhile on the client side
This function (written in Python because why not) queries my RDS database. It gets the visitor count, adds one and updates the table. The function returns the new value and displays it on the site.
On Github, when I push changes to the main branch. They trigger an action that replaces the files in the S3 bucket and invalidates the cached files on Cloudfront. This means that the next time you connect, you'll get the latest version of the files.
If you've ever deployed your site on a service like Netlify, this process is done auto-magically for you. It's nice to have the option of doing it manually because it gives you freedom. It is a lot of work though. It's like going through the exhaustive process of making a late at home. Buying the beans, grinding them, weighing, working the espresso machine, frothing the milk and doing the latte art. You can also just get one from Starbucks and call it a day. Nothing wrong with one or the other, just depends on your needs. ☕️
Implementing security with AWS Route 53
PD: I set a concurrency limit on the lambda function. This means that even if somebody wants to troll me and spam the endpoint, it's limited to 5 requests per minute.
- Alejandro 🧡