Gatsby related image

Deploy gatsbyjs based website to AWS s3 static site

Good link to Gatsby based GitLab-ci example.

AWS has superior performance, but is more complicated to set up and maintain.

AWS also has such aggressive caching that development is harder.

  • Create S3 bucket named like the domain, e.g.
  • Enable "Static website hosting."
  • Disable "Block public access (bucket settings)"
  • Edit bucket policy
  "Version": "2012-10-17",
  "Statement": [
      "Sid": "PublicReadGetObject",
      "Effect": "Allow",
      "Principal": "*",
      "Action": "s3:GetObject",
      "Resource": "*"
  • Create a CloudFront distribution
  • Add custom domain to CFD e.g.
  • Set Default root object in CFD to index.html