Skip to main content

Configuring Amazon S3 Buckets to Host a Static Website with a Custom Domain

Hands-On Lab

 

Photo of

Training Architect

Length

00:30:00

Difficulty

Intermediate

In this live AWS environment, we will create and configure a simple static website. We will go through configuring that static website with a custom domain, using Route 53 Alias record sets. This will demonstrate how to create very cost-efficient website hosting for sites that consist of files lie HTML, CSS, JavaScript, fonts, and images.

Code for the static site is here.

NOTE: Amazon has radically changed how S3 Buckets are administered in the portal. See the following site for the latest information: https://docs.aws.amazon.com/AmazonS3/latest/user-guide/block-public-access-bucket.html

When creating the bucket ... UNCHECK all of the 4 checkboxes on step 3 - set permissions. if you miss this, afterwards go to bucket permission, public access settings and remove all four restrictions. Then add a bucket policy, go to bucket, permissions bucket policy and add :- (replacing examplebucket with your bucket name

{
  "Version":"2012-10-17",
  "Statement":[{
    "Sid":"PublicReadGetObject",
        "Effect":"Allow",
      "Principal": "*",
      "Action":["s3:GetObject"],
      "Resource":["arn:aws:s3:::example-bucket/*"
      ]
    }
  ]
}
What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.