{"id":19156863,"url":"https://github.com/bertrandmartel/cloudformation-templates","last_synced_at":"2026-05-13T23:38:24.676Z","repository":{"id":94808007,"uuid":"238576342","full_name":"bertrandmartel/cloudformation-templates","owner":"bertrandmartel","description":":books: A collection of AWS cloudformation templates","archived":false,"fork":false,"pushed_at":"2020-04-13T00:06:44.000Z","size":230,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-19T05:44:12.594Z","etag":null,"topics":["aws","aws-cloudformation","ecs","elasticache","infrastructure-as-code","nat","subnet","vpc"],"latest_commit_sha":null,"homepage":"","language":"Go","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/bertrandmartel.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":"2020-02-06T00:29:35.000Z","updated_at":"2023-06-06T02:27:52.000Z","dependencies_parsed_at":"2023-03-14T10:48:44.146Z","dependency_job_id":null,"html_url":"https://github.com/bertrandmartel/cloudformation-templates","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bertrandmartel/cloudformation-templates","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertrandmartel%2Fcloudformation-templates","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertrandmartel%2Fcloudformation-templates/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertrandmartel%2Fcloudformation-templates/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertrandmartel%2Fcloudformation-templates/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bertrandmartel","download_url":"https://codeload.github.com/bertrandmartel/cloudformation-templates/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertrandmartel%2Fcloudformation-templates/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33004761,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"ssl_error","status_checked_at":"2026-05-13T13:14:51.610Z","response_time":115,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","aws-cloudformation","ecs","elasticache","infrastructure-as-code","nat","subnet","vpc"],"created_at":"2024-11-09T08:36:10.054Z","updated_at":"2026-05-13T23:38:24.657Z","avatar_url":"https://github.com/bertrandmartel.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CloudFormation templates\n\nA collection of cloudformation templates\n\n## Table of Content\n\n* [VPC Infra](#vpc-infra)\n* [ECS Infra](#ecs-infra)\n* [ElastiCache](#elasticache)\n* [Launch Lambda at creation](#lambda-launch-at-creation)\n\n## VPC Infra\n\n### 1 - Nat Instances\n\n[nat-instances.yml](https://github.com/bertrandmartel/cloudformation-templates/blob/master/vpc-infra/nat-instances.yml)\n\n![nat_instances](https://user-images.githubusercontent.com/5183022/73895563-52c6de80-4880-11ea-9678-7c8a29e93aa1.png)\n\nArchitecture featuring : \n\n* 1 VPC\n* 3 public subnet accross 3AZ\n* 3 private subnet accross 3AZ\n* 3 NAT instances accross 3AZ\n* 1 InternetGateway\n\nThe 3 NAT instances are living on different *public subnet* and have their own Security Group accepting incoming request (tcp \u0026 icmp) from their respective *private subnet*\n\nAlso 3 RoutingTable for each *private subnet* routes `0.0.0.0/0` to the corresponding NAT instance\n\n### 2 - Nat Gateway\n\n[nat-gateway.yml](https://github.com/bertrandmartel/cloudformation-templates/blob/master/vpc-infra/nat-gateway.yml)\n\n![nat_gateway](https://user-images.githubusercontent.com/5183022/73895546-3a56c400-4880-11ea-8d14-15dd8a8aa81d.png)\n\nArchitecture featuring : \n\n* 1 VPC\n* 3 public subnet accross 3AZ\n* 3 private subnet accross 3AZ\n* 3 NATGateway accross 3AZ\n* 1 InternetGateway\n\n3 RoutingTable for each *private subnet* routes `0.0.0.0/0` to the corresponding NAT Gateway\n\n### Pricing\n\nNote that using the Nat Gateway infra is 3 times more expensive than using Nat Instance (see [pricing](https://aws.amazon.com/vpc/pricing/))\n\n## ECS Infra\n\n[ecs-infra.yml](https://github.com/bertrandmartel/cloudformation-templates/blob/master/ecs/ecs-infra.yml)\n\n[ecs-service.yml](https://github.com/bertrandmartel/cloudformation-templates/blob/master/ecs/ecs-service.yml)\n\n![ecs-infra](https://user-images.githubusercontent.com/5183022/73895533-30cd5c00-4880-11ea-9824-e46d6b9917e4.png)\n\n### ECS Infra stack \n\nFeatures : \n\n* 1 ECS Cluster\n* 1 Application Load Balancer (ALB) on 3 Public subnet\n* 1 Listener on 80 redirecting to https\n* 1 Listener on 443 forwarding to a default Target Group\n* 1 AutoScalingGroup on 3 Private subnet\n\nThe ALB Security Group accept incoming tcp requests from '0.0.0.0/0' on port 80 and 443\n\nEC2 instances have SSM service installed (not installed by default on ECS optimized AMI)\n\n### ECS Service stack\n\nFeatures :\n\n* 1 ECS Service\n* 1 ECS TaskDefinition\n* 1 Target Group which is targeted by the ECS Service\n* 1 Listener Rule which route traffic for a specific hostname to the previous Target Group\n* 1 Route53 DNS Record with the specific hostname pointing to the ALB (see ECS infra stack above)\n\nSome notorious parameters :\n\n* HostZone: name of your hostzone\n* DockerImageURL: docker image URL\n\n## ElastiCache\n\n[elasticache.yml](https://github.com/bertrandmartel/cloudformation-templates/blob/master/elasticache/elasticache.yml)\n\n* ElastiCache Cluster\n\nSecurity Group of Elasticache Cluster accept incoming tcp request from '0.0.0.0/0' on port 6379\n\nThe subnet parameter should use private subnets\n\n## Lambda launch at creation\n\nIn order to launch a lambda at stack creation, you need to use a [Custom Resource](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources.html). You need to create a lambda expecting to receive Custom Resource Request Input. Using go, it looks like [that](https://github.com/aws/aws-lambda-go/blob/master/cfn/event.go#L17-L26).\n\nAlso you need to create a physical resource ID when you receive the Create event. And then re-use the physical resource ID you will receive in the UPDATE or DELETE subsequent events. Failing to doing so would result in your stack getting stuck in `DELETE_IN_PROGRESS` state.\n\nA minimal example in golang and the cloudformation stack :\n\n* [lambda/main.go](https://github.com/bertrandmartel/cloudformation-templates/blob/master/lambda/main.go)\n* [lambda/custom-resource.yml](https://github.com/bertrandmartel/cloudformation-templates/blob/master/lambda/custom-resource.yml)\n\nSome useful resources about custom resources / lambda : \n\n* https://stories.schubergphilis.com/cloudformation-coding-with-custom-resources-9249c45bf37\n* https://stackoverflow.com/a/41388529/2614364\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbertrandmartel%2Fcloudformation-templates","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbertrandmartel%2Fcloudformation-templates","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbertrandmartel%2Fcloudformation-templates/lists"}