{"id":18482611,"url":"https://github.com/kdcio/s3-cf-serverless-website","last_synced_at":"2026-04-19T02:02:54.219Z","repository":{"id":103391140,"uuid":"300139045","full_name":"kdcio/s3-cf-serverless-website","owner":"kdcio","description":"Boilerplate for setting up and deploying website to s3 \u0026 cloudfront using serverless.","archived":false,"fork":false,"pushed_at":"2020-10-22T23:24:58.000Z","size":193,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-22T20:09:08.671Z","etag":null,"topics":["aws","boilerplate","certificate","cloudfront","hacktoberfest","s3","serverless","starter"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kdcio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-01T04:14:59.000Z","updated_at":"2020-10-22T23:25:01.000Z","dependencies_parsed_at":"2023-05-04T00:42:54.447Z","dependency_job_id":null,"html_url":"https://github.com/kdcio/s3-cf-serverless-website","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kdcio/s3-cf-serverless-website","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdcio%2Fs3-cf-serverless-website","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdcio%2Fs3-cf-serverless-website/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdcio%2Fs3-cf-serverless-website/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdcio%2Fs3-cf-serverless-website/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kdcio","download_url":"https://codeload.github.com/kdcio/s3-cf-serverless-website/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdcio%2Fs3-cf-serverless-website/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31991720,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","boilerplate","certificate","cloudfront","hacktoberfest","s3","serverless","starter"],"created_at":"2024-11-06T12:29:20.514Z","updated_at":"2026-04-19T02:02:54.200Z","avatar_url":"https://github.com/kdcio.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# S3 and CloudFront Serverless\n\n## What does this do\n\n- Setup your website in AWS using [Serverless Framework](https://www.serverless.com/).\n- Creates resources for both root domain and www subdomain.\n- Auto redirect root domain to www subdomain.\n- Auto redirect http to https.\n- Easy deployment using [aws cli](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html).\n- Includes security headers using [AWS Lambda Edge](https://aws.amazon.com/lambda/edge/).\n- Includes **CustomErrorResponses** for **React** based websites.\n\n### Prerequisites\n\n- Install [Serverless](https://www.serverless.com/framework/docs/getting-started/)\n\n- Install [AWS Cli](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html)\n\n- Create an [AWS Profile](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html)\n\n- Create an SSL Certificate from AWS Console. Make sure you are in region **US East (N. Virginia)** (`us-east-1`). Take note of the certificate **ARN**.\n\n  ![Certificate](docs/images/certificate.png)\n\n### Clone this Repo\n\n```terminal\ngit clone https://github.com/kdcio/s3-cf-serverless-website.git\ncd s3-cf-serverless-website\n```\n\n### Configure\n\nCreate config file by copying `config.sample.yml` to `config.prod.yml`. Edit `config.prod.yml` and change values for **PROFILE**, **DOMAIN** and **DOMAIN_CERT**. DOMAIN is your root domain name (without _www_) and DOMAIN_CERT is the ARN value from the previous section.\n\n### Create S3 and CloudFront\n\nCreate S3 and CloudFront resources.\n\n```terminal\nnpm run deploy:setup prod\n```\n\nAfter successful deployment run:\n\n```terminal\nnpm run deploy:info\n```\n\nTake note of the **CFEndpoint** and **CFDistributionIdWWW** in the output.\n\n### Point Domain to CF\n\nIf your domain DNS is hosted on Route53, create a record set like below:\n\n![Certificate](docs/images/route53.png)\n\nAlias target is the **CFEndpoint** from previous section.\n\nIf hosted outside of AWS, use CNAME.\n\nDo this for both root domain and www subdomain.\n\n### Deployment\n\nEdit `package.json` and edit the lines below:\n\n```json\n\"scripts\": {\n  ...\n  \"deploy:s3\": \"AWS_PROFILE=\u003cPROFILE\u003e aws s3 sync build/ s3://www.\u003cDOMAIN\u003e\",\n  \"deploy:cf\": \"AWS_PROFILE=\u003cPROFILE\u003e aws cloudfront create-invalidation --distribution-id \u003cCFDistributionIdWWW\u003e --paths \\\"/*\\\"\",\n  ...\n},\n```\n\nReplace **PROFILE**, **DOMAIN** and **CFDistributionIdWWW**.\n\n### Deploy\n\n```terminal\nnpm run deploy\n```\n\nThis command will sync build folder with s3 bucket and invalidate cloudfront to reflect the new changes.\n\nEnjoy!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdcio%2Fs3-cf-serverless-website","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkdcio%2Fs3-cf-serverless-website","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdcio%2Fs3-cf-serverless-website/lists"}