{"id":18552391,"url":"https://github.com/traviswimer/serverless-respat-static-cloudfront","last_synced_at":"2025-05-15T11:12:49.384Z","repository":{"id":147421118,"uuid":"142041287","full_name":"traviswimer/serverless-respat-static-cloudfront","owner":"traviswimer","description":null,"archived":false,"fork":false,"pushed_at":"2018-07-26T19:00:09.000Z","size":67,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-15T11:12:40.975Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/traviswimer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"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":"2018-07-23T16:36:10.000Z","updated_at":"2018-07-26T19:00:10.000Z","dependencies_parsed_at":"2023-06-13T12:00:35.505Z","dependency_job_id":null,"html_url":"https://github.com/traviswimer/serverless-respat-static-cloudfront","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/traviswimer%2Fserverless-respat-static-cloudfront","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/traviswimer%2Fserverless-respat-static-cloudfront/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/traviswimer%2Fserverless-respat-static-cloudfront/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/traviswimer%2Fserverless-respat-static-cloudfront/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/traviswimer","download_url":"https://codeload.github.com/traviswimer/serverless-respat-static-cloudfront/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254328389,"owners_count":22052633,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-11-06T21:14:06.909Z","updated_at":"2025-05-15T11:12:44.374Z","avatar_url":"https://github.com/traviswimer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# serverless-respat-static-cloudfront\n\n\u003e Resource pattern to setup a Cloudfront distribution for a static site hosted on S3.\n\n## Usage\n\nThis package is intended for use with the **serverless-respat plugin**. ([install/usage info](https://github.com/traviswimer/serverless-respat)).\n\nInstall:\n\n`npm install --save-dev serverless-respat-static-cloudfront`\n\nAdd patterns to the \"custom\" object in your serverless config file:\n\n```javascript\n\"custom\": {\n\t\"serverless-respat\": {\n\t\tprefix: \"${self:service}-${opt:stage}\",\n\t\tpatterns: [\n\t\t\t{\n\t\t\t\tpattern: require(\"serverless-respat-static-cloudfront\"),\n\t\t\t\tconfig: {\n\t\t\t\t\tdomain: \"YOURDOMAIN\",\n\t\t\t\t\tregion: '${self:provider.region}',\n\t\t\t\t\tuse_https: true,\n\t\t\t\t\tdefault_root_object: \"index.html\",\n\t\t\t\t\tcertificate_arn: 'ACM_CERT_ARN',\n\t\t\t\t\torigins: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: \"ApiGatewayOrigin\",\n\t\t\t\t\t\t\tpath: \"/my-api\",\n\t\t\t\t\t\t\tdomain: {\n\t\t\t\t\t\t\t\t\"Fn::Join\": [\n\t\t\t\t\t\t\t\t\t\"\",\n\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t// \"ApiGatewayRestApi\" is generated by Serverless\n\t\t\t\t\t\t\t\t\t\t\t\"Ref\": \"ApiGatewayRestApi\"\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\".execute-api.${self:provider.region}.amazonaws.com\"\n\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tpath_pattern: \"api/*\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t}\n}\n```\n\nBefore this will work, you need to create an S3 bucket with the same name as your domain. A good choice for deploying your static site to the bucket is the [serverless-finch](https://github.com/fernando-mc/serverless-finch) plugin.\n\n**You will also need to setup Route53 (or other DNS service) to point to the Cloudfront resource created**\n\n## Config options\n\n* **pattern_name** (string, _default: \"StaticCloudfront\"_) - A pattern name included in resource names.\n\n* **use_https** (boolean, _default: true_) - If true, you site will use HTTPS\n\n* **domain** (string, REQUIRED) - Your website domain name\n\n* **region** (string, REQUIRED) - AWS region\n\n* **default_root_object** (string, REQUIRED) - The root file used from your S3 bucket\n\n* **certificate_arn** (string, REQUIRED) - The ARN for the ACM certificate to use for HTTPS\n\n* **origins** - (array) List of objects defining the origins to include\n  * **id** - (string, REQUIRED) ID to use for the origin\n  * **path** - (string, REQUIRED) The origin path\n  * **path_pattern** - (string, REQUIRED) Pattern to use for the origin\n  * **domain** - (string, REQUIRED) The domain the origin should point to. (An API Gateway, etc.)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftraviswimer%2Fserverless-respat-static-cloudfront","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftraviswimer%2Fserverless-respat-static-cloudfront","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftraviswimer%2Fserverless-respat-static-cloudfront/lists"}