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. www.pseekoo.at.
  • 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": "arn:aws:s3:::www-dev.pseekoo.at/*"
    }
  ]
}
  • Create a CloudFront distribution
  • Add custom domain to CFD e.g. www-dev.pseekoo.at
  • Set Default root object in CFD to index.html