Website Architecture

How I made this website

This site does not use any servers. This saves a lot of money! 💸
This website uses an AWS Lambda λ, which is a serverless compute service which allows me run this website code without provisioning or managing servers.
Here is an image of the architecture for this website.

Website Architecture

Here's how I did it!

I'll explain how each section is used in creating this website.
This project was created using terraform in the AWS region eu-west-1 (Ireland).

Google Domains

I had purchased my domain paragpindoria.com using Google Domains.
This costs £10 per year to renew.

Route 53 Hosted Zone

In order to connect my domain registered with Google to AWS, I needed to create a hosted zone.
The hosted zone provides 4 NS records, which I needed to amend on Google Domains to the ones associated with the hosted zone in AWS.
I selected Use custom name servers on Google Domains and pasted the 4 NS records.

Certificate Manager

Having a certificate ensures that my website will be transferred over a secure network.
In order to give my domain an SSL/TLS Certificate, I needed to provision a certificate, using Certificate Manager.
This certificate was created in us-east-1 (North Virginia), as the Edge-optimized custom domain name only accepts certificates in this region.
I entered my domain paragpindoria.com along with www.paragpindoria.com and *.paragpindoria.com. This will be useful if I deploy any other subdomains in the future.
Then I selected validation using DNS. This returns a couple of CNAME records, which would need to be added to the hosted zone created in Route 53 earlier.
After a couple of minutes to hours, the certificates were successful and the certificate was issued.

CloudFront Distribution

CloudFront is a Global Content Delivery Network.
This is used alongside the API Gateway when creating custom domain names to be an alias with my API invocation URL.

API Gateway

The API Gateway is where the lambda can return content to the front end users via a URL
A trigger is sent to the lambda giving the route of the URL and the lambda returns the content for that specified route back to the user.

Lambda λ

Lambda is a serverless compute service which allows me run this website code without provisioning or managing servers. The lambda is triggered by an API request when a user accesses the website.
This retrieves the path of the URL and the lambda gets the appropriate template.
The lambda is written using Python and the main package handling the web app is Flask.
More details on this can be found here.

CloudWatch Logs

CloudWatch logs are essential when monitoring and debugging my website and lambda.
I can see where users are accessing pages that are returning 404 pages, as well as general code bugs.
When events such as returning the 404 page occur, I can set up alerts and fix the issues, if there are, promptly.

S3 Bucket

The S3 Bucket is where I store all my website assets, such as the images shown above.
The html references the location of where the images are in the S3 bucket.

SNS Email Notification

On my website, I have a form on my contact page so that a user can contact me.
For this to work, I used a boto3 in python to publish messages using SNS.
So once a user completes the form and clicks submit, a post request is sent and the message in the form is sent to my email.