{"id":18819388,"url":"https://github.com/smoketurner/sam-cdn","last_synced_at":"2025-04-13T23:33:09.013Z","repository":{"id":42189992,"uuid":"228699176","full_name":"smoketurner/sam-cdn","owner":"smoketurner","description":"AWS project to deploy a CDN for hosting static assets in private S3 buckets","archived":false,"fork":false,"pushed_at":"2023-12-11T12:08:28.000Z","size":514,"stargazers_count":20,"open_issues_count":1,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T14:01:40.898Z","etag":null,"topics":["aws","cloudfront","lambda-edge","route53","s3","sam","serverless"],"latest_commit_sha":null,"homepage":"https://serverlessrepo.aws.amazon.com/applications/arn:aws:serverlessrepo:us-east-1:860114833029:applications~cloudfront-cdn","language":null,"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/smoketurner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"jplock","patreon":"jplock"}},"created_at":"2019-12-17T20:49:28.000Z","updated_at":"2024-05-17T16:49:47.000Z","dependencies_parsed_at":"2023-01-31T00:02:07.312Z","dependency_job_id":"fe72b931-b6d1-4c46-8a3a-87bb740d555a","html_url":"https://github.com/smoketurner/sam-cdn","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smoketurner%2Fsam-cdn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smoketurner%2Fsam-cdn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smoketurner%2Fsam-cdn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smoketurner%2Fsam-cdn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smoketurner","download_url":"https://codeload.github.com/smoketurner/sam-cdn/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248797127,"owners_count":21163090,"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":["aws","cloudfront","lambda-edge","route53","s3","sam","serverless"],"created_at":"2024-11-08T00:22:52.968Z","updated_at":"2025-04-13T23:33:08.665Z","avatar_url":"https://github.com/smoketurner.png","language":null,"funding_links":["https://github.com/sponsors/jplock","https://patreon.com/jplock"],"categories":[],"sub_categories":[],"readme":"[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/smoketurner/sam-cdn/master/LICENSE)\n[![build status](https://github.com/smoketurner/sam-cdn/workflows/Node%20CI/badge.svg)](https://github.com/smoketurner/sam-cdn/actions?query=workflow%3A%22Node+CI%22)\n[![Launch Stack](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://console.aws.amazon.com/lambda/home?#/create/app?applicationId=arn:aws:serverlessrepo:us-east-1:860114833029:applications/cloudfront-cdn)\n\nA project that deploys a content delivery network (CDN) using AWS CloudFront for static assets hosted in a private S3 bucket.\n\nThis project creates the following resources:\n\n- `AWS::CertificateManager::Certificate` - `*.\u003cdomain\u003e` SSL certificate\n- `AWS::CloudFront::Distribution` - `[http|https]://\u003cdomain\u003e` distribution\n- `AWS::CloudFront::Distribution` - `[http|https]://www.\u003cdomain\u003e` redirect distribution\n- `AWS::CloudFront::CloudFrontOriginAccessIdentity`\n- `AWS::Route53::RecordSet` - `\u003cdomain\u003e` IPv4 DNS entry\n- `AWS::Route53::RecordSet` - `\u003cdomain\u003e` IPv6 DNS entry\n- `AWS::Route53::RecordSet` - `www.\u003cdomain\u003e` IPv4 DNS entry\n- `AWS::Route53::RecordSet` - `www.\u003cdomain\u003e` IPv6 DNS entry\n- `AWS::S3::Bucket` - private access log bucket\n- `AWS::S3::Bucket` - private static asset bucket\n- `AWS::S3::Bucket` - private bucket to redirect requests to `https://\u003cdomain\u003e`\n- `AWS::S3::BucketPolicy` - only allow CloudFront to access static asset bucket\n- `AWS::CloudFront::Function` - CloudFront Function for single page applications to redirect requests to `/index.html`\n- `AWS::CloudFront::Function` - CloudFront Function to add various web security HTTP response headers\n\n## Installation\n\n```\ngit clone https://github.com/smoketurner/sam-cdn.git\ncd sam-cdn\nnpm install\n```\n\n## Deploy\n\n```\nnpm run build\nnpm run deploy\n```\n\nYou can upload your static assets into the S3 bucket and Route53 and CloudFront will take care of any redirections and content serving for you.\n\n## References\n\n- https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/example-function-add-index.html\n- https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/example-function-add-security-headers.html\n- https://www.awsadvent.com/2018/12/03/vanquishing-cors-with-cloudfront-and-lambdaedge/\n- https://medium.com/faun/hardening-the-http-security-headers-with-aws-lambda-edge-and-cloudfront-2e2da1ae4d83\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmoketurner%2Fsam-cdn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmoketurner%2Fsam-cdn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmoketurner%2Fsam-cdn/lists"}