sunmingtao / sample-code

3 stars 4 forks source link

How to set up static web hosting in s3? #140

Closed sunmingtao closed 4 years ago

sunmingtao commented 4 years ago

https://docs.aws.amazon.com/AmazonS3/latest/user-guide/static-website-hosting.html

  1. Properties -> Static website hosting -> Choose "Use this bucket to host a website"
  2. Permissions -> Block public access -> Off
  3. Permissions -> Bucket Policy Replace bucket-name with the real bucket name
    {
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PublicReadGetObject",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::bucket-name/*"
        }
    ]
    }
  4. Upload index.html

Find the endpoint at static web hosting

image