Host a Website on Amazon S3
Deploy a static website to AWS S3 and configure public access permissions.
Introduction
30 Second Summary
Every website you visit lives on a server somewhere. When companies put their websites online, they use cloud services to store and serve files to anyone in the world.
In this project, you will deploy your own static website to Amazon S3, making it accessible to anyone on the internet via a public URL.
What You'll Build
A personal static website hosted on Amazon S3 that is publicly accessible via a unique URL.
By the end of this project, you'll have:
- A configured AWS account on the Free Plan.
- An S3 bucket configured for static website hosting.
- A live index.html page uploaded and accessible on the internet.
- A bucket policy granting public read access to your website files.
- Secret Mission: Create a styled custom 404 error page so visitors see a friendly message instead of the default AWS error.
Are there any prerequisites?
None. This project is entirely browser-based and guides you through creating your AWS account from scratch. All you need is a text editor (like VS Code or Notepad++) and a web browser.
Create Your AWS Account
Before you can host anything on the cloud, you need access to it. AWS is the most widely used cloud platform in the world, powering everything from Netflix to NASA.
In this step, you will create your free AWS account, sign in to the AWS Management Console, and find the S3 service where your website will live.
In this step, get ready to:
- Create an AWS account on the Free Plan.
- Sign in to the AWS Management Console.
- Navigate to the S3 service.
Create a free AWS account
AWS offers a Free Plan for new accounts that gives you up to $200 in credits over 6 months. You will not be charged for this project.
- Open your web browser and go to https://aws.amazon.com/free/.
- Click Create an AWS Account.
- Select the Free Plan when prompted.
- Enter your email address and choose an AWS account name.
- Complete email verification by entering the code sent to your inbox.
- Create a strong root user password.
- Enter your contact information and verify your phone number.
- Enter a valid credit or debit card. AWS requires this for identity verification, but you will not be charged on the Free Plan.
- Select the Basic support - Free plan when asked about support options.
- Click Complete sign up.
What is the AWS Free Plan?
New AWS accounts created after July 15, 2025 receive $100 in credits at signup, with up to $100 more for exploring services. Your Free Plan lasts 6 months.
You will not be charged unless you explicitly switch to the Paid Plan. The storage used in this project is negligible and well within your free credits.
Having trouble signing up?
If your email verification code does not arrive, check your spam folder. Some email providers delay delivery by a few minutes.
If your card is declined, try a different card. AWS requires a valid payment method even though the Free Plan does not charge you.
help me troubleshoot my AWS account creation
Sign in to the AWS Management Console
The AWS Management Console is your control panel for every AWS service. It is a web-based interface where you create, configure, and manage cloud resources.
- Go to https://console.aws.amazon.com/.
- Sign in with the email address and password you just created.
- Select Root user as the sign-in type.
After signing in, you should see the Console Home dashboard with a search bar at the top and a list of AWS services.
Why does the Console look so complex?
AWS has over 200 services, so the Console can feel overwhelming at first. You only need one service for this project: S3. The search bar at the top is the fastest way to find any service.
Navigate to S3
Amazon S3 (Simple Storage Service) is where your website files will live. Think of it as a hard drive in the cloud that can serve files directly to the internet.
- Click the search bar at the top of the Console.
- Type S3.
- Click S3 from the dropdown results.
You should see the S3 dashboard with General purpose buckets in the left navigation. This is where you will create your website's storage bucket in the next step.
Don't see the S3 dashboard?
Make sure you clicked the correct S3 result in the search dropdown. There are other services with similar names (like S3 Glacier). Look for the one labeled S3 - Scalable Storage in the Cloud.
If your account was just created, it may take a few minutes for all services to become available. Try refreshing the page.
help me find the S3 service in the AWS Console
Your AWS account is ready and you have found the S3 service. Next up, you will create your first S3 bucket and configure it to host a website.
Create and Configure Your S3 Bucket
Your AWS account is ready and you're inside the Management Console. Now it's time to create the storage space for your website.
Every file on your website needs a home in the cloud. In AWS, that home is an S3 bucket. Think of it as a folder that AWS makes available to the entire internet. In this step, you'll create your bucket and tell AWS to treat it as a website.
In this step, get ready to:
- Create a new S3 bucket with a unique name.
- Enable static website hosting on your bucket.
- Copy your website's public URL for later use.
Create a new S3 bucket
A bucket is the top-level container where all your website files will live. Each bucket name must be globally unique across all of AWS, so no two people in the world can have the same bucket name.
- On the S3 page, click Create bucket.
- In the Bucket name field, enter a unique name using only lowercase letters, numbers, and hyphens. For example: my-first-aws-website-2026.
- For AWS Region, choose the region closest to you. For example, US East (N. Virginia) us-east-1.
- Leave all other settings at their defaults.
- Scroll to the bottom and click Create bucket.
You should see a green success banner at the top of the page, and your new bucket listed under General purpose buckets.
What is an AWS Region?
An AWS region is a physical location in the world where AWS runs its data centers. Choosing a region close to you means your website loads faster for nearby visitors.
Your bucket and its files live in whichever region you select. For this project, any region works fine.
Seeing a 'Bucket name already exists' error?
Bucket names are globally unique. If someone else already took your name, try adding extra numbers or your initials (for example, janes-aws-website-2026).
Make sure you only use lowercase letters, numbers, and hyphens. Uppercase letters, spaces, and underscores are not allowed.
Help me fix my bucket name error.
Enable static website hosting
By default, S3 buckets are just storage containers. You need to explicitly tell AWS that this bucket should serve files as a website.
- Click on your new bucket name in the bucket list to open it.
- Click the Properties tab.
- Scroll all the way to the bottom of the page to find Static website hosting.
- Click Edit.
- Select Enable.
- Under Hosting type, select Host a static website.
- In the Index document field, type index.html.
- Click Save changes.
What is static website hosting?
Static website hosting tells AWS to serve your files directly to web browsers, just like a traditional web server. Without it, S3 would only let authorized users download files through the AWS API.
The index document is the default page visitors see when they go to your website URL. It works the same way as a homepage on any website.
Copy your website endpoint URL
Now that hosting is enabled, AWS has created a public URL for your website. You'll need this URL to test your site in a later step.
- After saving, scroll back down to the Static website hosting section at the bottom of the Properties tab.
- Find the Bucket website endpoint URL. It looks something like http://my-first-aws-website-2026.s3-website-us-east-1.amazonaws.com.
- Copy this URL and save it somewhere you can find it easily (a notes app, a sticky note, or a new browser tab).
Keep this URL handy
You'll paste this URL into your browser in Step 4 to see your live website. Don't worry if visiting it now shows an error. That's expected because you haven't uploaded any files or set permissions yet.
Your bucket is created and configured to serve a website. Next up, you'll open the permissions so that anyone on the internet can actually view your site.
Configure Permissions for Public Access
Your S3 bucket is created and static website hosting is enabled. There is one problem though. AWS locks down all buckets by default, meaning no one on the internet can actually access your files yet.
In this step, you will configure permissions to allow public access. This involves two changes: removing the default access block, and writing a policy that explicitly grants read permission to everyone.
In this step, get ready to:
- Disable Block Public Access on your S3 bucket.
- Write and apply a bucket policy granting public read access.
Disable Block Public Access
AWS has a safety feature called Block Public Access that prevents anyone from reaching your bucket's contents. For a public website, you need to turn this off.
- Click the Permissions tab on your bucket page.
- Under Block public access (bucket settings), click Edit.
- Uncheck Block all public access.
- Click Save changes.
- A confirmation dialog appears. Type confirm in the text field and click Confirm.
Why does AWS block public access by default?
Most S3 buckets store private data like application logs, backups, or user uploads. Blocking public access by default prevents accidental data leaks.
Since you are intentionally hosting a public website, you need to explicitly disable this protection. AWS requires the typed confirmation so you cannot accidentally make a bucket public.
You should now see a green banner confirming that Block Public Access settings have been updated.
Don't see the confirmation banner?
Make sure you typed confirm exactly (lowercase, no spaces) in the confirmation dialog. If the Confirm button is greyed out, the text does not match.
Help me disable Block Public Access on my S3 bucket
Add a bucket policy
Even with Block Public Access disabled, AWS still needs you to explicitly state who can do what with your bucket. A bucket policy is a JSON document that defines these permissions.
- Still on the Permissions tab, scroll down to Bucket policy.
- Click Edit.
- Delete any existing text in the policy editor, then paste the following JSON policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::[[BUCKET_NAME="your-bucket-name"]]/*"
}
]
}
What does this policy do?
- "Principal": "*" means anyone on the internet.
- "Action": "s3:GetObject" means they can read (download) files.
- "Resource": "arn:aws:s3:::your-bucket-name/*" targets every object in your bucket.
Together, this tells AWS: allow anyone to read any file in this bucket. This is how permissions work in AWS. Every action requires explicit permission.
- Replace your-bucket-name in the Resource line with the actual name of your S3 bucket.
- Click Save changes.
You should see a green banner confirming the policy was saved. You may also notice a Publicly accessible warning label on your bucket. This is expected for a public website.
Seeing an error when saving the policy?
- Check that you replaced your-bucket-name with your actual bucket name in the Resource line. The bucket name must match exactly.
- Make sure Block Public Access is fully disabled. If it is still enabled, the policy will be rejected.
- Verify there are no extra commas, missing quotes, or typos in the JSON. The format must be valid JSON.
Help me fix my S3 bucket policy
Why JSON for permissions?
AWS uses JSON-based policies across all its services. Whether you are controlling access to storage, databases, or servers, the format is always the same: who (Principal), what action (Action), and which resource (Resource).
Learning this pattern now means you already understand how permissions work across the entire AWS ecosystem.
Your bucket is now publicly accessible. Next up, you will create your HTML file and upload it to see your website live on the internet.
Upload Your Website and Go Live
Your S3 bucket is fully configured with public access permissions. Anyone on the internet can now read files from it.
There is just one problem. The bucket is empty. In this step, you will create an HTML page on your computer, upload it to S3, and see your website go live on the internet.
In this step, get ready to:
- Create an index.html file with HTML and CSS styling.
- Upload the file to your S3 bucket.
- Visit your live website using the bucket endpoint URL.
Create your index.html file
Every website needs a homepage. When someone visits your S3 website endpoint, AWS looks for the file you specified as the index document. You set that to index.html in Step 2.
- Open your text editor (VS Code, Notepad++, or any editor you have).
- Create a new file.
- Copy and paste the following HTML code into the file:
<!DOCTYPE html>
<html>
<head>
<title>My First AWS Website</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 800px;
margin: 50px auto;
padding: 20px;
background-color: #f0f8ff;
text-align: center;
}
h1 {
color: #232f3e;
}
p {
color: #555;
font-size: 1.2em;
}
.badge {
background-color: #ff9900;
color: white;
padding: 10px 20px;
border-radius: 5px;
display: inline-block;
margin-top: 20px;
font-weight: bold;
}
</style>
</head>
<body>
<h1>Welcome to My First AWS Website!</h1>
<p>This site is hosted on Amazon S3.</p>
<p>I built this as my first cloud project.</p>
<div class="badge">Powered by AWS S3</div>
</body>
</html>
What does this code do?
This is a complete webpage with built-in styling. The <style> section defines how the page looks: a centered layout with a light blue background, dark headings, and an orange badge at the bottom.
The <body> section holds the visible content: a heading, two paragraphs, and a styled badge that says "Powered by AWS S3".
- Save the file as index.html in a folder on your computer (for example, your Desktop).
- Make sure the filename is exactly index.html with no extra spaces or capital letters.
File saved as index.html.txt?
Some text editors (especially Notepad on Windows) add a .txt extension automatically. Make sure your file ends in .html only. In Notepad, change the "Save as type" dropdown to "All Files" before saving.
How do I make sure my file is saved as .html and not .txt?
Upload your file to S3
Now you need to get your HTML file from your computer into your S3 bucket. The AWS Console has a built-in upload feature for this.
- Go back to your S3 bucket in the AWS Console.
- Click the Objects tab.
- Click Upload.
- Click Add files and select the index.html file you just saved.
- Click Upload.
- Wait for the green "Upload succeeded" banner to appear, then click Close.
You should now see index.html listed in the Objects tab of your bucket.
Don't see your file listed?
Make sure you clicked the final Upload button on the upload page (not just Add files). If the upload succeeded but you do not see the file, try refreshing the page.
Help me troubleshoot my S3 file upload.
Test your live website
Your file is in S3, your permissions are set, and static hosting is enabled. Everything is in place for your website to be live on the internet.
- Open a new browser tab.
- Paste the Bucket website endpoint URL you saved earlier (from the Properties tab under Static website hosting).
- Press Enter.
You should see your website with a light blue background, the heading "Welcome to My First AWS Website!", and an orange badge at the bottom.
Where do I find my endpoint URL again?
Go to your bucket, click the Properties tab, and scroll to the very bottom. The URL is listed under Static website hosting. It looks like http://my-first-aws-website-2026.s3-website-us-east-1.amazonaws.com.
Seeing a 403 Forbidden error?
This means AWS is blocking public access to your file. Check two things:
- On the Permissions tab, confirm that Block all public access is set to "Off" (all checkboxes unchecked).
- On the same tab under Bucket policy, confirm your policy is saved and that the Resource field contains your exact bucket name followed by /*.
I'm getting a 403 error when visiting my S3 website. Help me fix it.
Why is the URL HTTP and not HTTPS?
S3 website endpoints only support HTTP. To add HTTPS, you would need to put CloudFront (AWS's content delivery network) in front of your bucket. For a learning project, HTTP is perfectly fine.
Your website is live on the internet. Anyone with the URL can see it right now. Next up, you have a Secret Mission to make your site even more professional.
Secret mission
Create a Custom 404 Error Page
Right now, if someone visits a page that doesn't exist on your website, AWS shows a generic XML error. Your mission is to create a custom error page that matches your site's design and gives visitors a friendly way back to your homepage.
Clean Up Your Resources
Clean Up Your Resources
Decide whether to keep your resources running, pause them to come back later, or delete them entirely. This project runs on the AWS Free Plan with negligible storage costs, so there are no ongoing charges to worry about.
Resources you used:
- 1 AWS account (free, no charges on the Free Plan).
- 1 S3 bucket with static website hosting enabled.
- HTML files stored in S3 (negligible storage cost, well within free credits).
Keep everything running
No action needed. Choose this if you want your website to stay live at the S3 endpoint URL.
- Your website will remain accessible at your bucket website endpoint.
- The storage cost for a few small HTML files is essentially $0.
- This is completely safe to leave running on the Free Plan.
Pause - I'll come back to this later
Block public access to take your site offline while keeping the bucket and files intact. You can re-enable it later without re-uploading anything.
- Open your S3 bucket in the AWS Console.
- Click the Permissions tab.
- Under Block public access (bucket settings), click Edit.
- Check Block all public access and click Save changes.
- Type confirm in the confirmation dialog and click Confirm.
- Your website will return a 403 error until you uncheck this setting again.
Delete - I don't want to use this again
Remove all project resources and start fresh. This permanently deletes your bucket and all files in it.
- Open your S3 bucket in the AWS Console.
- Click the Objects tab.
- Select all objects using the checkbox at the top of the list.
- Click Delete, type permanently delete to confirm, and click Delete objects.
- Go back to the S3 bucket list by clicking Buckets in the left navigation.
- Select your bucket using its checkbox.
- Click Delete, type your bucket name to confirm, and click Delete bucket.
Nice Work!
Nice Work!
You just deployed your first website to the cloud! You now have a live static site running on Amazon S3, accessible to anyone on the internet via a public URL.
Here's what you learned:
- Created an AWS account and navigated the Management Console to find and configure S3.
- Configured an S3 bucket for static website hosting and uploaded HTML files to make them publicly accessible.
- Wrote and applied a bucket policy in JSON to grant public read access, learning how AWS permissions control who can do what.
- Created a custom 404 error page and configured S3 error document handling so visitors see a friendly message instead of the default AWS error.
These are the same foundational skills used in every AWS certification exam and every cloud engineering role. Ready to quiz yourself?