Create an AWS S3 Bucket for Hosting a Static React App

InstructorSam Julien

Share this video with your friends

Send Tweet

Creating an S3 bucket is a straightforward process. You just have to make sure that you are using a unique name. But, there are a couple of things you need to do in order to host a static site on an S3 bucket.

First, under the properties tab, you need to enable static website hosting. Make sure to provide the index document to your app.

Second, you need to add a bucket policy. You can find examples in the policy examples docs. In our case, we will use the example under "Granting read-only permission to an anonymous user"

Bucket policy that was copy pasted:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PublicRead",
            "Effect": "Allow",
            "Principal": "*",
            "Action":["s3:GetObject", "s3:GetObjectVersion"],
            "Resource:["arn:aws:s3:::DOC-EXAMPLE-BUCKET/*"]
        }
    ]
}
Jon Seidel
~ 6 months ago

Would have been helpful to say where in the AWS documentation that particular permission policy was found... or have it in the notes. I tried several which didn't work and finally had to go type it in from the video.