Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
Google Cloud Platform icon
Labs

Setting Up an S3 Static Website Using AWS CLI

In this hands-on lab, we'll be setting up an S3 bucket website. We'll also verify the website is accessible and working as expected. S3 bucket websites are excellent for hosting single-page, customer-facing content, as they are easy to set up and offer the same high availability and scalability as S3.

Google Cloud Platform icon
Lab platform
Lab Info
Level
Intermediate
Last updated
Apr 06, 2025
Duration
30m

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
Table of Contents
  1. Challenge

    Create an S3 Bucket from AWS CLI
    1. Create an S3 bucket in the us-east-1 region, giving your bucket a globally unique name, using the S3 API:

      aws s3api create-bucket --bucket <UNIQUE_BUCKET_NAME> --acl public-read
      
  2. Challenge

    Modify the Newly Created Bucket to Be an S3 Website Bucket
    1. Issue the AWS S3 API CLI command to enable the "Static website hosting" property of your bucket. In this same command, you'll also provide the index.html page, which is what your bucket URL will serve:

      aws s3 website s3://<UNIQUE_BUCKET_NAME> --index-document index.html
      
  3. Challenge

    Modify Provided S3 Policy File and Use It to Modify Bucket Policy
    1. Open policy_s3.json using vi/vim.

    2. Put in the name of your bucket.

    3. Save and exit the file.

    4. Use the S3 policy file to modify the bucket policy so your objects are publicly accessible, which is a requirement for S3 static websites:

      cd
      aws s3api put-bucket-policy --bucket <UNIQUE_BUCKET_NAME> --policy file://policy_s3.json
      
  4. Challenge

    Create a Basic `index.html` Page and Upload File
    1. Create a basic HTML page:

      echo "<html><center><h1>My Static Website on S3</h1></center></html>" > index.html
      
    2. Upload the index.html file to your S3 website bucket using the AWS S3 API CLI:

    aws s3 cp index.html s3://<UNIQUE_BUCKET_NAME>
    
  5. Challenge

    Verify Your S3 Static Website Is Working
    1. Enter the S3 website URL for your bucket in the browser to ensure it's working.

    2. You can also test from the terminal using the curl command:

      curl http://<UNIQUE_BUCKET_NAME>.s3-website.us-east-1.amazonaws.com
      
About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

Real skill practice before real-world application

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight