Under the services tab, go to S3

Then, click "Create Bucket"

Put in the name of the bucket, and copy settings from the bucket. Then, click "Create"
<aside> 💡 CONVENTION: The name of the S3 bucket has to be the same as the name of the staging when it is fully deployed. For instance, for the staging "inventory-staging.beautymnl.com", the source S3 bucket is also named "inventory-staging.beautymnl.com".
</aside>

Search for the newly created S3 bucket and click it

Then, go to properties. And find "Static Website Hosting". Set the values for index and error documents, then hit save.
<aside> 💡 You are required to add an Index document. Usually, that's index.html. During your vue-build processes, the npm automatically produces index.html
</aside>

The properties pane should look like this, with bucket hosting enabled!

Go to the permissions tab, and under bucket policy, set the bucket policy. Just copy the JSON document below. Remember to remove the comment and change the resource
<aside> 💡 Bucket policies are one of 2 ways to control access to an S3 bucket. The statement below allows anyone with the link to access our S3 bucket. This exposes all the contents of our S3 buckets, which makes it ideal for static website hosting.
</aside>
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "AllowPublicRead",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
// CHANGE THIS RESOURCE!! AND REMOVE THIS COMMENT!!
"Resource": "arn:aws:s3:::inventory-develop-staging-2.beautymnl.com/*"
}
]
}

After hitting save, you will see this:

To test it, upload a picture

Then, go to that picture

You should see the picture you uploaded. This is the picture I happen to upload.
<aside> 💡 What does this prove? Since you are in incognito, it proves that anyone access the contents of the S3 bucket. That it is public access!!
</aside>

Create a custom error response


Under the services tab, go to CloudFront
<aside> 💡 What does CloudFront do? It is a Content Delivery Network that allows you to cache your website's assets such as JS, CSS, Images to a location nearer to your customers than if they'd have to retrieve it from the content's origin. In this case, instead of the customer having to fetch the static assets from Singapore's S3 bucket, it just fetches from an edge location in the Philippines.
</aside>

Click "Create Distribution"

Choose Web (always!)

Follow the following condition
