Host a Website on Amazon S3
Deploy a live static website to Amazon S3 using the AWS CLI.
Introduction
30 Second Summary
Every website you visit lives on a server somewhere. What if you could put your own website on the internet without managing a server at all?
In this project, you will host a static website on Amazon S3 and make it accessible to anyone with a public URL. You will also install and configure the AWS CLI to deploy your files from the command line.
What You'll Build
A personal static website hosted on Amazon S3, deployed using the AWS CLI and secured with a bucket policy for public access.
By the end of this project, you'll have:
- An S3 bucket configured for static website hosting.
- A styled HTML/CSS website deployed to S3 using the AWS CLI.
- A bucket policy granting public read access so anyone can visit your site.
- Secret Mission: Add a custom error page and automate deployments with aws s3 sync.
Are there any prerequisites?
You need an AWS account with Free Tier eligibility. If you do not have one yet, create a free account at aws.amazon.com before starting Step 1.
Install and Configure the AWS CLI
To host your website on Amazon S3, you need a way to talk to AWS from your own computer.
The AWS CLI (Command Line Interface) is the tool that makes this possible. In this step, you will install it, create a secure identity for your machine to use, and connect everything together.
In this step, get ready to:
- Install AWS CLI v2 on Windows.
- Create an IAM user with S3 permissions.
- Configure the CLI with your credentials and verify the connection.
Download and install the AWS CLI v2
The AWS CLI lets you manage AWS services by typing commands instead of clicking through the web console. You will install it using the official Windows installer.
- Download the AWS CLI v2 installer by visiting this link in your browser:
- https://awscli.amazonaws.com/AWSCLIV2.msi
- Run the downloaded AWSCLIV2.msi file.
- The installer will open a setup wizard. Click Next on each screen, accept the license agreement, and click Install.
- When the installation finishes, click Finish.
Why download an MSI file?
An MSI file is a standard Windows installer package. It registers the AWS CLI on your system and adds it to your PATH so you can run aws commands from any Command Prompt window.
Now verify that the installation worked.
- Press the Windows key to open your search bar.
- Type Command Prompt and press Enter to open it.
- Verify the AWS CLI is installed by running this command:
aws --version
Check the output that appears in your Command Prompt.
✔️ I see aws-cli/2. in the output
The AWS CLI v2 is installed and ready. You should see something like aws-cli/2.35.11 Python/3.12.6 Windows/10. The exact numbers may differ and that is fine. Move on to the next substep.
ⓧ I see aws-cli/1. in the output
You have an older version (AWS CLI v1) installed. You need version 2 for this project.
- Uninstall AWS CLI v1 by opening Settings, then Apps, then Apps & features.
- Search for AWS Command Line Interface and click Uninstall.
- Download and install the v2 installer from https://awscli.amazonaws.com/AWSCLIV2.msi.
- Close and reopen Command Prompt, then run aws --version again.
ⓧ Command not recognized
If you see a message saying that aws is not recognized as a command, the installer may not have completed correctly or Command Prompt was open during installation.
- Close Command Prompt completely.
- Reopen it by pressing the Windows key, typing Command Prompt, and pressing Enter.
- Run aws --version again.
- If you still see the error, re-run the AWSCLIV2.msi installer and make sure it finishes without errors.
Create an IAM user with programmatic access
Your AWS account needs a dedicated identity for the CLI to use. This identity is called an IAM user. You will create one and give it permission to manage S3.
- Open your browser and sign in to the AWS Management Console at https://console.aws.amazon.com.
- In the top search bar, type IAM and select IAM from the results.
- In the left navigation pane, click Users.
- Click Create user.
- For User name, type s3-cli-user.
- Click Next.
- On the Set permissions page, select Attach policies directly.
- In the search box under Permissions policies, type AmazonS3FullAccess.
- Check the box next to AmazonS3FullAccess in the results.
- Click Next.
- Review the details and click Create user.
Now you need to generate an access key for this user.
- Click on the user name s3-cli-user to open the user details page.
- Click the Security credentials tab.
- Scroll down to the Access keys section and click Create access key.
- For the use case, select Command Line Interface (CLI).
- Check the confirmation box at the bottom and click Next.
- Skip the optional tag and click Create access key.
- Click Download .csv file to save your Access Key ID and Secret Access Key to your computer.
- Click Done.
Save your secret access key now
The secret access key is only shown once. After you click Done, you cannot view it again. If you lose it, you will need to delete the key and create a new one.
Keep the downloaded CSV file in a safe location. Do not share it or commit it to any code repository.
What is an IAM user?
An IAM user is a separate identity within your AWS account. Instead of using your root (main) account credentials for everything, you create users with only the permissions they need.
The AmazonS3FullAccess policy gives this user full control over S3 buckets and objects, which is exactly what you need to host a website.
Configure the AWS CLI with your credentials
With the AWS CLI installed and your access key downloaded, you can now connect them. The aws configure command stores your credentials locally so the CLI can authenticate every request you make.
- Switch back to your Command Prompt window.
- Run the configuration command:
aws configure
The command prompts you for four values one at a time. Enter each and press Enter:
- AWS Access Key ID: paste the Access Key ID from your downloaded CSV file.
- AWS Secret Access Key: paste the Secret Access Key from your downloaded CSV file.
- Default region name: type us-east-1.
- Default output format: type json.
What do these settings mean?
The region tells AWS where to create resources by default. us-east-1 is the US East (N. Virginia) region, a common choice with the widest service availability.
The output format controls how the CLI displays results. json is structured and easy to read for beginners.
Now verify that the CLI can reach AWS using your credentials.
- Confirm your identity by running this command:
aws sts get-caller-identity
You should see a JSON response containing your account number, user ID, and the ARN of your IAM user.
What should I see?
A successful response looks like this (your numbers will be different):
{
"UserId": "AIDAEXAMPLEID",
"Account": "123456789012",
"Arn": "arn:aws:iam::123456789012:user/s3-cli-user"
}
If you see this, your CLI is authenticated and ready to manage AWS resources.
Seeing an error instead of JSON?
If you get an error about invalid credentials, open your CSV file and double-check that you pasted the Access Key ID and Secret Access Key correctly. Run aws configure again to re-enter them.
If you see a message about an expired token, make sure you selected Command Line Interface (CLI) as the use case when creating the access key.
help me debug my aws configure error
Your AWS CLI is installed, configured, and verified. Next up, you will create an S3 bucket to host your website files.
Create an S3 Bucket
Your website needs a home on the internet. In Amazon S3, that home is called a bucket.
A bucket is a container that holds your files and makes them accessible via a unique web address. In this step, you'll create your own S3 bucket and configure it so the public can eventually view your website files.
In this step, get ready to:
- Create an S3 bucket with a globally unique name.
- Disable Block Public Access so your website can be viewed by anyone.
- Verify the bucket exists using the AWS CLI.
Navigate to S3 and create a new bucket
Every S3 bucket name must be unique across all AWS accounts worldwide. Your bucket name becomes part of its web address, so no two people can have the same one.
- In the AWS Management Console, type S3 in the search bar at the top.
- Select S3 from the search results.
- Click Create bucket.
- Under Bucket type, select General purpose.
- Under Bucket name, enter a globally unique name for your bucket (e.g., my-first-website-yourname).
- Under AWS Region, select US East (N. Virginia) us-east-1.
Why does the bucket name need to be globally unique?
S3 bucket names share a single global namespace across every AWS account in the world. Your bucket name becomes part of its public URL, so AWS needs to guarantee no duplicates exist.
A good pattern is to include your name or a random string, like my-first-website-alex or my-first-website-2026.
Disable Block Public Access
By default, S3 blocks all public access to protect your data. Since you want anyone on the internet to view your website, you need to turn this off during bucket creation.
- On the same Create bucket page, scroll down to the Block Public Access settings for this bucket section.
- Uncheck Block all public access.
- A warning message appears below. Check the acknowledgment box to confirm you understand these settings may result in public access.
- Leave all other settings at their defaults.
- Scroll to the bottom and click Create bucket.
Why disable Block Public Access?
S3 enables Block Public Access by default to prevent accidental data exposure. For static website hosting, you need the public to read your files. Disabling it now allows you to attach a public-read bucket policy in a later step.
You should see a green success banner at the top of the page confirming your bucket was created.
Seeing a "Bucket name already exists" error?
Someone else in the world already has that name. Try adding extra characters or numbers to make it unique (e.g., add today's date or your initials).
help me fix my S3 bucket name error
Verify your bucket from the command line
You just created the bucket in the console. Now confirm it exists by listing your buckets from the AWS CLI you configured in the previous step.
- Switch back to your Command Prompt.
- List all your S3 buckets by running this command:
aws s3 ls
You should see your bucket name in the output, along with the date it was created.
Don't see your bucket in the list?
Make sure you configured the AWS CLI with the same account you used to create the bucket in the console. Run aws sts get-caller-identity to confirm you are signed in as the correct IAM user.
Also check that your default region in aws configure is set to us-east-1. S3 bucket names are global, but the list command uses your configured credentials.
help me troubleshoot why my S3 bucket doesn't appear in aws s3 ls
Your bucket is live and ready. Next up, you'll build the HTML and CSS files that will become your website.
Build Your Website
Your S3 bucket is set up and ready to serve files to the internet. Now you need the actual website files to put inside it.
In this step, you'll build a simple HTML page and a CSS stylesheet in VS Code. These two files are everything S3 needs to display a styled website to your visitors.
In this step, get ready to:
- Create a project folder for your website files.
- Write an HTML page with a heading and introduction.
- Add CSS styling for layout and visual polish.
Create your project folder
Before writing any code, you need a dedicated folder on your Desktop to hold your website files. This keeps your project organized and makes it easy to upload everything to S3 later.
- Press the Windows key to open your search bar.
- Type Command Prompt and press Enter to open it.
- Move to your Desktop by running this command:
cd %USERPROFILE%\Desktop
- Create your project folder by running this command:
mkdir my-website
- Confirm the folder was created by running:
dir
You should see my-website listed in the output.
- Open the folder in VS Code by running:
code my-website
VS Code opens with the my-website folder loaded in the Explorer sidebar on the left.
'code' is not recognized?
If you see an error, the code command was not added to your system PATH during VS Code installation. Close Command Prompt, reinstall VS Code, and make sure the Add to PATH checkbox is selected during setup.
Alternatively, open VS Code manually by pressing the Windows key, typing Visual Studio Code, pressing Enter, then clicking File > Open Folder and selecting the my-website folder on your Desktop.
help me open my project folder in VS Code
Create the HTML page
Every website starts with an HTML file. This file defines the structure and text content that visitors see when they load your page.
- In VS Code's Explorer sidebar on the left, hover over the MY-WEBSITE heading.
- Click the New File icon (a page with a plus sign).
- Type index.html and press Enter.
- Paste the following code into the empty file:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Cloud Website</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<h1>Hello, I'm learning cloud engineering!</h1>
<p>This website is hosted on Amazon S3. I built and deployed it using the AWS CLI as part of my cloud engineering journey.</p>
<p>Next up: virtual machines, networking, and infrastructure as code.</p>
</div>
</body>
</html>
What does this code do?
- The <head> section sets the page title and links to an external stylesheet called style.css.
- The <div class="container"> wraps all visible content in a single box that you'll style later.
- The <h1> and <p> tags define the heading and paragraph text that visitors will read.
- Save index.html by pressing Ctrl+S.
- Open the my-website folder on your Desktop in File Explorer, then double-click index.html to open it in your browser.
You should see the heading and two paragraphs of text. The page looks plain and unstyled because the CSS file does not exist yet.
Don't see any text in the browser?
Make sure you saved the file in VS Code (Ctrl+S). Unsaved files show a dot on the tab name.
Check that the file is named exactly index.html (not index.html.txt). Windows sometimes hides file extensions, making this hard to spot.
help me fix my index.html file not displaying in the browser
✔️ Awesome, I've got everything!
Great. Make sure index.html is saved before moving on.
ⓧ I'd like to double check the full code
Your index.html should look exactly like this:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Cloud Website</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<h1>Hello, I'm learning cloud engineering!</h1>
<p>This website is hosted on Amazon S3. I built and deployed it using the AWS CLI as part of my cloud engineering journey.</p>
<p>Next up: virtual machines, networking, and infrastructure as code.</p>
</div>
</body>
</html>
Style your page with CSS
Right now your page is just plain text on a white background. A CSS file controls colors, fonts, spacing, and layout to make the page look polished.
- In VS Code's Explorer sidebar, hover over MY-WEBSITE and click the New File icon again.
- Type style.css and press Enter.
- Paste the following code into the empty file to set up the page-level layout:
body {
font-family: Arial, sans-serif;
background-color: #f0f4f8;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
What does this code do?
- font-family sets the page to use Arial as the default font.
- background-color: #f0f4f8 applies a soft blue-gray background to the entire page.
- display: flex combined with justify-content and align-items centers your content both horizontally and vertically.
- min-height: 100vh makes the body fill the full browser window height.
- Save style.css and refresh your browser tab where index.html is open.
You should see the background change to a light blue-gray, and your text is now centered in the middle of the page.
- Now add the content styling below the body block in style.css:
.container {
background-color: #ffffff;
padding: 40px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
max-width: 600px;
text-align: center;
}
h1 {
color: #232f3e;
margin-bottom: 20px;
}
p {
color: #555555;
line-height: 1.6;
}
What does this code do?
- .container creates a white card with rounded corners and a subtle shadow, giving your content a clean, modern look.
- max-width: 600px prevents the text from stretching too wide on large screens.
- The h1 rule sets the heading to a dark navy color.
- The p rule sets paragraph text to a medium gray with comfortable line spacing.
- Save style.css and refresh your browser.
You should see your text inside a white card with rounded corners, centered on the blue-gray background. The heading is dark navy and the paragraphs are a softer gray.
Page still looks unstyled?
Check that your CSS file is named exactly style.css (not styles.css or style.CSS). The name must match the href value in your HTML file.
Make sure both index.html and style.css are in the same folder (my-website). If the CSS file is somewhere else, the browser cannot find it.
help me fix my CSS not loading on my HTML page
✔️ Awesome, I've got everything!
Great. Make sure style.css is saved before moving on.
ⓧ I'd like to double check the full code
Your style.css should look exactly like this:
body {
font-family: Arial, sans-serif;
background-color: #f0f4f8;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.container {
background-color: #ffffff;
padding: 40px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
max-width: 600px;
text-align: center;
}
h1 {
color: #232f3e;
margin-bottom: 20px;
}
p {
color: #555555;
line-height: 1.6;
}
Your website files are ready to go. Next up, you'll configure your S3 bucket to serve these files as a live website and set the permissions so anyone on the internet can view them.
Configure Static Website Hosting and Permissions
Your HTML and CSS files are built and ready to go. Now it's time to configure your S3 bucket so it knows how to serve those files as a live website.
S3 buckets store files, but they don't automatically serve them to web browsers. You need to enable a feature called static website hosting and then set a permission policy that allows anyone on the internet to view your pages.
In this step, get ready to:
- Enable static website hosting on your S3 bucket.
- Apply a bucket policy that grants public read access.
- Verify your bucket is publicly accessible.
Enable static website hosting
Static website hosting tells S3 to respond to browser requests by returning your HTML files. Without it, S3 treats your files as plain objects with no web-serving behaviour.
- Switch back to the S3 Console in your browser.
- In the left navigation pane, click General purpose buckets.
- Click the name of the bucket you created earlier (e.g., my-first-website-yourname).
- Click the Properties tab.
- Scroll down to the Static website hosting section and click Edit.
- Select Enable under Static website hosting.
- In the Index document field, type index.html.
- Click Save changes.
What is an index document?
The index document is the default page S3 returns when someone visits your website URL without specifying a file name. Setting it to index.html means visitors see your homepage automatically.
The name is case sensitive. It must match your uploaded file exactly.
- After saving, scroll back down to the Static website hosting section on the Properties tab.
- Find the Bucket website endpoint URL displayed there. Copy this URL and save it somewhere (a text file or sticky note). You will need it later to visit your live site.
What does the endpoint URL look like?
For a bucket in us-east-1, the endpoint follows this format: http://bucket-name.s3-website-us-east-1.amazonaws.com. This is the public address where your website will be available once you finish configuring permissions and uploading files.
Don't see the endpoint URL?
Make sure you clicked Save changes after enabling static website hosting. The endpoint only appears after the configuration is saved successfully.
If you still don't see it, confirm you selected Enable (not Disable) under the Static website hosting setting.
help me find my S3 bucket website endpoint URL
Apply a public read bucket policy
Your bucket can now serve web pages, but nobody on the internet can actually read the files yet. A bucket policy is a JSON document that defines who is allowed to do what with your bucket's contents.
- Click the Permissions tab on your bucket's page.
- Scroll down to the Bucket policy section and click Edit.
- Delete any existing text in the policy editor, then paste the following policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::[[BUCKET_NAME="my-first-website-yourname"]]/*"
]
}
]
}
What does this policy do?
This policy grants public read access to every object in your bucket. Here is what each part means:
- "Principal": "*" means anyone (the entire internet).
- "Action": ["s3:GetObject"] allows reading (downloading) objects.
- "Resource" specifies which bucket and objects the rule applies to. The /* at the end means all objects inside the bucket.
- Replace my-first-website-yourname in the Resource line with your actual bucket name.
- Click Save changes.
Seeing "Policy has invalid resource"?
This error means the bucket name in your policy does not match your actual bucket name. Double-check that the Resource line contains your exact bucket name with no extra spaces or typos.
If you get a different error about public access being blocked, confirm that you disabled Block all public access back in Step 2 when you created the bucket.
help me fix my S3 bucket policy error
Verify the bucket is publicly accessible
After saving the policy, S3 updates the bucket's access status. You can confirm everything is configured correctly from the main S3 bucket list.
- Click General purpose buckets in the left navigation pane to return to the bucket list.
- Look at the Access column next to your bucket name. It should say Public.
Why does it say Public?
The "Public" label confirms two things: Block Public Access is off for this bucket, and a policy is actively granting access to anyone. This is exactly what you need for a public website.
Bucket not showing as Public?
If the Access column still shows "Objects can be public" or "Bucket and objects not public", your bucket policy may not have saved correctly. Go back to the Permissions tab and confirm the policy JSON is present under Bucket policy.
help me make my S3 bucket publicly accessible for website hosting
Your bucket is now configured to serve web pages and anyone on the internet can read your files. Next up, you will upload your website files and see your page live on the web.
Deploy and Test Your Live Website
Your bucket is configured, your permissions are set, and your website files are ready to go. Now it's time to put it all together and push your site live.
In this step, you'll use the AWS CLI to upload your files to S3, visit your live website in a browser, and confirm that updates deploy instantly.
In this step, get ready to:
- Upload your website files to your S3 bucket using the AWS CLI.
- Visit your live website in the browser.
- Make a change and redeploy to confirm updates go live instantly.
Upload your website files to S3
Your my-website folder has two files that need to reach your S3 bucket. The AWS CLI can upload an entire folder in one command.
- Switch back to your Command Prompt window.
- Navigate to your my-website folder by running this command:
cd Desktop\my-website
- Upload all files in the folder to your S3 bucket by running this command:
aws s3 cp . s3://[[BUCKET_NAME="your-bucket-name"]]/ --recursive
What does this command do?
This command copies everything in the current folder (represented by the dot .) to your S3 bucket.
The --recursive flag tells the CLI to include all files and subfolders, not just a single file.
- You should see output confirming two uploads: index.html and style.css.
Seeing 'upload failed' or 'Access Denied'?
- Double check you are inside the correct folder. Run dir to confirm you see index.html and style.css listed.
- Make sure your bucket name is spelled exactly as it appears in the S3 Console. Bucket names are case-sensitive.
- Verify your IAM user has the AmazonS3FullAccess policy attached. You configured this in Step 1.
Help me troubleshoot my aws s3 cp upload error
Visit your live website in the browser
Your files are now in the bucket. The static website hosting you enabled in the previous step means S3 will serve them as a real website.
- Open your browser (Chrome, Edge, or Firefox).
- Paste the Bucket website endpoint URL you noted from Step 4 into the address bar. The URL follows this format:
http://[[BUCKET_NAME="your-bucket-name"]].s3-website-us-east-1.amazonaws.com
Find your endpoint URL again
If you lost the URL, go to your bucket in the S3 Console, click the Properties tab, and scroll down to Static website hosting. The endpoint URL is displayed there.
- Press Enter to load the page.
You should see your styled personal page live on the internet. The heading, paragraph text, and centered white card should all appear exactly as they did locally in VS Code.
Seeing a 403 Forbidden or blank page?
- Make sure you are using the website endpoint URL (contains s3-website), not the regular S3 object URL.
- Verify your bucket policy is saved correctly. Go to the Permissions tab and confirm the policy grants s3:GetObject to Principal "*".
- Confirm that Block Public Access is still disabled on your bucket. It must be off for the public policy to work.
Help me debug why my S3 static website returns 403 Forbidden
Make a change and redeploy
A live website is only useful if you can update it. Let's prove that redeploying is as simple as running the same upload command again.
- Switch back to VS Code.
- Open index.html.
- Find the <h1> line:
<h1>Hello, I'm learning cloud engineering!</h1>
- Change the heading text to something different, for example:
<h1>Hello from Amazon S3!</h1>
- Save index.html.
- Switch back to Command Prompt and re-upload your files by running the same command:
aws s3 cp . s3://[[BUCKET_NAME="your-bucket-name"]]/ --recursive
- Switch back to your browser and refresh the page.
Your updated heading should now appear on the live site. Any time you change a file locally, one CLI command is all it takes to push it live.
Why is redeployment so fast?
S3 serves files directly from storage. There is no build process, no server restart, and no waiting for a deploy pipeline. The moment the file lands in the bucket, the next browser request picks it up.
Still seeing the old heading?
- Make sure you saved the file in VS Code before re-running the upload command.
- Try a hard refresh in your browser. Press Ctrl+Shift+R (Windows) to bypass the browser cache.
- Confirm the upload output shows index.html was uploaded successfully.
Help me figure out why my S3 website is not showing my latest changes
Secret mission
Add an Error Page and Automate Deployments
Your website works great when visitors land on the right page. But what happens when someone types a URL that does not exist? Right now, they get an ugly default error page from S3. In this secret mission, you will create a custom error page and learn a faster way to deploy your files using aws s3 sync.
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 uses AWS Free Tier, so your website costs $0 while Free Tier is active.
Cost warning
After your AWS Free Tier expires (12 months from account creation), leaving your S3 bucket with static website hosting active costs approximately $1-3 per month depending on traffic.
If you don't plan to keep using this site, choose Pause or Delete below to avoid unexpected charges.
Resources you used:
- S3 bucket with static website hosting enabled, containing index.html, style.css, and error.html.
- Local my-website folder on your Desktop.
Keep everything running
No action needed. Choose this if you are still actively building or want to keep your site live on the internet.
- Your website stays accessible via the S3 bucket website endpoint URL.
- Free Tier covers all S3 costs for 12 months from account creation.
- Your AWS CLI and IAM user remain configured and ready for future cloud projects.
Pause - I'll come back to this later
Make your website private while keeping your bucket and files intact. You can restore public access later without re-uploading anything.
- In the AWS Console, navigate to your S3 bucket.
- Click the Permissions tab.
- Under Block public access (bucket settings), click Edit.
- Check the box for Block all public access and click Save changes.
- Type confirm in the confirmation box and click Confirm.
Your site is now private. When you are ready to go live again, repeat the same steps but uncheck the box.
Delete - I don't want to use this again
Remove all project resources completely. This stops any potential charges and cannot be undone.
- Delete your S3 bucket and all its contents by running this command in Command Prompt:
aws s3 rb s3://[[BUCKET_NAME="your-bucket-name"]] --force
What does this command do?
The rb subcommand stands for "remove bucket". The --force flag deletes all objects inside the bucket first, then removes the bucket itself.
- Delete the local my-website folder from your Desktop.
macOS
- Run this command in your terminal:
rm -rf ~/Desktop/my-website
Windows
- Run this command in Command Prompt:
rmdir /s /q %USERPROFILE%\Desktop\my-website
- Confirm the folder is gone by checking your Desktop.
Nice Work!
Nice Work!
You just built and deployed a live website on the internet using Amazon S3. Anyone with the link can visit your page right now.
You've learned how to:
- Installed and configured the AWS CLI to manage cloud services from your command line.
- Created an S3 bucket with static website hosting enabled and applied a bucket policy to grant public read access.
- Built a styled HTML/CSS website and deployed it to S3 using the CLI, then verified it was live via a public endpoint URL.
- Secret Mission: Added a custom error page and used aws s3 sync for faster, more efficient redeployments.
Ready to quiz yourself?