Designing My First AWS Project: A Beginner's Guide to Static Website Hosting
A beginner-friendly introduction to designing a static website hosting architecture using Amazon S3 and Amazon CloudFront. This article explores how these AWS services work together, basic security considerations, and what I learned while starting my AWS journey.
Introduction
When I started exploring cloud computing, AWS was one of the first platforms I came across. At first, the number of services and new terminology felt overwhelming. Instead of trying to learn everything at once, I decided to start with a simple question:
How would I host a basic website using AWS?
This article documents my first AWS project as a beginner. Rather than jumping straight into a complicated application, I wanted to understand the fundamental building blocks of cloud hosting and how different AWS services can work together.
The project I designed is a simple static website hosting architecture using Amazon S3 and Amazon CloudFront.
What Are We Building?
The goal is to design an architecture where a user can open a website through the internet and receive its static content from AWS.
The website could contain:
- HTML
- CSS
- JavaScript
- Images
- Videos
- Other static files
A simplified version of the architecture looks like this:
User
│
▼
Internet
│
▼
Amazon CloudFront
│
▼
Amazon S3
│
▼
Website Files
HTML / CSS / JS / Images
Understanding the AWS Services
Before designing the architecture, I needed to understand what each service actually does.
- Amazon S3
Amazon Simple Storage Service (S3) is an object storage service.
For this project, I can think of S3 as the place where my website files live.
Amazon S3 supports static website hosting, meaning it can serve static website content such as HTML, CSS and JavaScript.
- Amazon CloudFront
The next part of the architecture is Amazon CloudFront.
CloudFront is AWS's content delivery network (CDN). Instead of every user having to retrieve content directly from the original storage location, CloudFront can deliver content through its globally distributed infrastructure.
AWS's secure static website architecture uses S3 as the storage layer and CloudFront as the CDN layer.
Why Use Both S3 and CloudFront?
At first, I wondered: If S3 can host a static website, why do we need CloudFront?
This is where the architecture becomes more interesting.
S3 provides the storage and website content, while CloudFront provides the content delivery layer.
Using CloudFront can provide benefits such as:
- Content delivery through a CDN
- Lower latency for users
- HTTPS support
- Better control over how content is delivered
- Additional security options
AWS specifically documents a secure static website architecture using CloudFront + S3, where CloudFront serves the website while S3 stores the content.
Security: The Part I Didn't Want to Ignore
One thing I learned while researching this project is that simply making an S3 bucket publicly accessible isn't necessarily the best approach.
AWS's documentation recommends keeping Block Public Access enabled where possible and using CloudFront with Origin Access Control (OAC) for a secure static website architecture.
With OAC, CloudFront can authenticate its requests to the S3 origin.
The idea becomes:
User
│
▼
CloudFront
│
▼
Authenticated
Request
│
▼
S3
The Architecture
Putting everything together, the architecture looks like this:
┌──────────────┐
│ User │
└──────┬───────┘
│
▼
┌──────────────┐
│ CloudFront │
│ CDN │
└──────┬───────┘
│
Secure Request
│
▼
┌──────────────┐
│ S3 │
│ Bucket │
└──────┬───────┘
│
▼
┌────────────────────┐
│ Website Static Files │
│ HTML / CSS / JS │
└────────────────────┘
The flow is straightforward:
- A user requests the website.
- The request reaches CloudFront.
- CloudFront checks its cache for the requested content.
- If necessary, CloudFront retrieves the content from S3.
- S3 provides the requested object.
- CloudFront delivers the content to the user.
What I Learned From This Project
The biggest lesson for me was that cloud computing isn't just about running a server somewhere else.
It's about understanding how different services solve different problems.
In this small project:
- S3 provides storage.
- CloudFront provides content delivery.
- OAC helps secure access between CloudFront and S3.
- The user interacts with the application without needing to know where the underlying files are stored.
I also learned that there can be multiple ways to accomplish the same goal in AWS.
Conclusion
This was my first attempt at understanding how a website could be designed using AWS services.
Starting with a simple static website helped me break AWS into smaller pieces instead of trying to understand the entire platform at once. S3 handles the website's storage, while CloudFront can provide the delivery layer, with Origin Access Control helping secure access to the S3 origin.
I haven't built a large cloud application yet, but this project gave me a starting point and, more importantly, a better understanding of how cloud services fit together.
This is just the beginning of my AWS learning journey.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article