1. Let’s create a bucket ‘my-test-vite-react-app’ :

image.png

REMOVE Block Public Access to make it public

image.png

  1. Set Bucket Policy (for public access)

Go to PermissionsBucket Policy, and add:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "PublicReadGetObject",
      "Effect": "Allow",
      "Principal": "*",
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::my-test-vite-react-app/*"
    }
  ]
}

image.png

  1. Enable Static Hosting inside Bucket Properties

image.png

We have the URL, time to upload the app :

image.png

  1. Go to you React App and run ‘npm run build’

And once done, you will have dist folder, the items inside of which we are going to upload on out S3 bucket -

image.png