{"id":20697502,"url":"https://github.com/epomatti/aws-cloudfront-waf","last_synced_at":"2026-05-18T19:42:56.977Z","repository":{"id":108711773,"uuid":"525176390","full_name":"epomatti/aws-cloudfront-waf","owner":"epomatti","description":"CloudFront with ELB and S3 origins + WAF","archived":false,"fork":false,"pushed_at":"2024-10-22T21:30:50.000Z","size":1378,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-17T18:36:41.146Z","etag":null,"topics":["aws","aws-cloudfront","aws-elb","aws-security","aws-waf","cloudfront","elb","terraform","waf"],"latest_commit_sha":null,"homepage":"","language":"HCL","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/epomatti.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2022-08-16T00:09:36.000Z","updated_at":"2024-10-22T21:30:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"45c2debd-58a7-4b83-b430-710f9518a1d6","html_url":"https://github.com/epomatti/aws-cloudfront-waf","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/epomatti%2Faws-cloudfront-waf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epomatti%2Faws-cloudfront-waf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epomatti%2Faws-cloudfront-waf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epomatti%2Faws-cloudfront-waf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/epomatti","download_url":"https://codeload.github.com/epomatti/aws-cloudfront-waf/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242961747,"owners_count":20213315,"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","aws-cloudfront","aws-elb","aws-security","aws-waf","cloudfront","elb","terraform","waf"],"created_at":"2024-11-17T00:18:34.041Z","updated_at":"2026-05-18T19:42:51.953Z","avatar_url":"https://github.com/epomatti.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AWS CloudFront WAF\n\nCloudFront with WAF serving S3 and ELB origins.\n\n\u003cimg src=\".assets/cloudfront.png\" /\u003e\n\n## Create the infrastructure\n\nCreate the `.auto.tfvars`:\n\n```sh\ncp config/template.auto.tfvars .auto.tfvars\n```\n\nApply the infrastructure:\n\n```sh\nterraform init\nterraform apply -auto-approve\n```\n\nOrigins will be available for testing:\n\n\u003cimg src=\".assets/web.png\" width=500/\u003e\n\n\n[Standard logs][1] (access logs) will be enabled by default:\n\n\u003cimg src=\".assets/cfaccesslogs.png\" /\u003e\n\n\n## CloudFront managed prefix\n\nAdditional security can be implemented by [restricting the ELB][2] into accepting only CloudFront origins. Enable that by setting the security group to use the AWS managed prefix `com.amazonaws.global.cloudfront.origin-facing`.\n\n\u003e [!NOTE]\n\u003e The managed prefix ID will vary depending on the regions\n\n```terraform\nenable_cloudfront_managed_prefix      = true\nelb_cloudfront_managed_prefix_list_id = \"pl-b6a144df\"\n```\n\nMore can be found in the [location for edge servers][3] and [restricting access to load balancer][4].\n\n---\n\n### Clean-up\n\n```sh\nterraform destroy -auto-approve\n```\n\n[1]: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/AccessLogs.html\n[2]: https://aws.amazon.com/blogs/networking-and-content-delivery/limit-access-to-your-origins-using-the-aws-managed-prefix-list-for-amazon-cloudfront/\n[3]: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/LocationsOfEdgeServers.html\n[4]: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/restrict-access-to-load-balancer.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepomatti%2Faws-cloudfront-waf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fepomatti%2Faws-cloudfront-waf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepomatti%2Faws-cloudfront-waf/lists"}