{"id":20678584,"url":"https://github.com/codecentric/accelerate-kickstarter-aws","last_synced_at":"2026-02-03T17:01:45.307Z","repository":{"id":55801442,"uuid":"494352979","full_name":"codecentric/accelerate-kickstarter-aws","owner":"codecentric","description":"Kickstarts a cloud environment with Terraform. Builds and deploys a Kotlin-based Spring Boot demo app to Amazon ECS (Fargate) using AWS CI/CD services (CodeBuild, CodeDeploy, etc.)","archived":false,"fork":false,"pushed_at":"2022-08-11T12:01:04.000Z","size":45,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-11-16T21:22:31.606Z","etag":null,"topics":["aws","cicd","kotlin","terraform"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codecentric.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}},"created_at":"2022-05-20T06:48:46.000Z","updated_at":"2024-01-11T21:39:43.000Z","dependencies_parsed_at":"2022-08-15T07:10:31.909Z","dependency_job_id":null,"html_url":"https://github.com/codecentric/accelerate-kickstarter-aws","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/codecentric%2Faccelerate-kickstarter-aws","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecentric%2Faccelerate-kickstarter-aws/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecentric%2Faccelerate-kickstarter-aws/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecentric%2Faccelerate-kickstarter-aws/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codecentric","download_url":"https://codeload.github.com/codecentric/accelerate-kickstarter-aws/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234382669,"owners_count":18823332,"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","cicd","kotlin","terraform"],"created_at":"2024-11-16T21:21:01.987Z","updated_at":"2025-09-27T03:31:50.164Z","avatar_url":"https://github.com/codecentric.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kickstarter template for accelerating cloud native projects 🚀\n\nThis project explores bootstrapping a greenfield cloud software project in the quickest possible way. The goal was to find a setup that helps to get into the feedback loop with minimum hassle, many DevOps features available out of the box, and little to no self-managed infrastructure. Also, I wanted to keep as many resources as possible (i.e. _all resources_) within AWS to minimize the need for external Repos, Terraform Cloud accounts, etc.\n\n## What's in the box? 🧰\n\nThis project comes with\n\n- a terraform stack that builds a dev and prod compute environment in AWS with automated ci/cd and blue/green deployment\n- a sample application with a http endpoint so we have something to play around with\n\n## What technologies/AWS services are used?\n\nThe following technologies and services are used:\n\n- Hashicorp Terraform (for creating and managing all AWS resources)\n- An 'as-simple-as-possible' Kotlin-powered Spring Boot project (so that we have something that we can deploy and play around with)\n- Docker (for packaging the application)\n- AWS CodeCommit/CodeBuild/CodePipeline/CodeDeploy (for hosting, building, and deploying our application)\n- AWS ECR (for storing our container images)\n- AWS ECS/Fargate (for running the application with minimum management overhead and to simplify scaling)\n\nTerraform remote state information and locking is maintained in S3/DynamoDB.\n\nThis sample was built with the help of Amazon's excellent labs and workshops on ECS and CI/CD:\n\n- [ECS/Fargate/Terraform Lab](https://devops-ecs-fargate.workshop.aws/en/)\n- [CI/CD workshop for Amazon ECS](https://catalog.us-east-1.prod.workshops.aws/v2/workshops/869f7eee-d3a2-490b-bf9a-ac90a8fb2d36/en-US)\n\n## Quick setup 🔨\n\nIn order to run this sample, you'll need:\n\n- An AWS account\n- The [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html)\n- [Terraform](https://learn.hashicorp.com/tutorials/terraform/install-cli)\n- Git\n\nThe detailed setup steps for setting up the AWS CLI and Terraform can be found below. \nAssuming you have everything set up and ready to go, running this sample involves the following steps:\n\n### Initial Setup for Remote State \u0026 Locking\n\n1. checkout this project\n2. cd into the `terraform/remote-state` directory, run `terraform init`\n3. run `terraform apply`\n\nYou now have all initial resources to maintain the state of your Terraform stack within AWS (S3 \u0026 DynamoDB).\n\n### Infrastructure setup\n\n1. cd into the `terraform/infrastructure` directory, run `terraform init`\n2. run `terraform apply`\n\nThe infrastructure for maintaining, building, deploying, and running your application is now ready. Pay attention to the stack's output, mainly `source_repo_clone_url_http` and `ecs_task_execution_role_arn_prod`, you will need these in the next step.\n\n### Prepare the application and trigger blue/green deployment to production\n\n1. Use the previous stack's output (`source_repo_clone_url_http`) and use `git clone \u003curl\u003e` to clone it to a location of your choice\n2. copy all contents of the `cloud-bootstap-app` directory into the empty repo directory, then `cd` into it\n3. In order for CodeDeploy to be able to create ECS tasks (during blue/green deployment), create your own ecs task definition from the prepared template by filling in your execution role's arn:\n\n```shell\n# make sure to perform this step in your cloned application repo from step 1 \u0026 2\nexport TASK_EXEC_ROLE_ARN=\u003cyour-prod-exec-role-arn-from-terraform-output\u003e\nenvsubst \u003c taskdef-prod.json.template \u003e taskdef-prod.json\nrm taskdef-prod.json.template\n```\n\n4. commit and push the changes\n5. check the ci/cd execution in the [CodePipeline console](https://console.aws.amazon.com/codepipeline), optionally have a look at the service events in the [ECS console](https://console.aws.amazon.com/ecs) to observe the deployment process\n6. Test the DEV stage: Hit the load balancer's endpoint URL (see `alb_address_dev` stack output) - the service should be online (a good idea would be to hit the service's Swagger UI @ `/swagger-ui.html`).\n7. Change the application's code on your machine (maybe add a mountain in `MountainsController.kt`?), commit and push\n8. Check the [CodePipeline console](https://console.aws.amazon.com/codepipeline) again. upon successful deployment to DEV, there is a manual approval step that you'll need to confirm in order to trigger the PROD deployment\n9. Upon approval, the blue/green deployment to PROD is triggered. Observe it in the [CodeDeployment console](https://console.aws.amazon.com/codedeploy) and the [ECS console](https://console.aws.amazon.com/ecs). Deployment should take a few minutes.\n10. Verify that the changes have actually been deployment to production by `curl`ing the application's PROD endpoint (see `alb_address_prod` stack output)\n\nThat's it.\n\nShould you run into any errors along the way, please have a look at the initial setup steps below. Also, please don't forget to tear down everything when you're done to avoid unnecessary cost.\n\n## Detailed Setup\n\nThe following section dives deeper into the steps required to get started.\n\n### Configuring the AWS CLI\n\nConfigure the AWS CLI to match the desired region:\n\n```bash\naws configure\nAWS Access Key ID [None]: \nAWS Secret Access Key [None]: \nDefault region name [None]: eu-central-1\nDefault output format [None]: \n```\n\n### Adjust Terraform variables\n\n```bash\ncd terraform/infrastructure\n```\n\nEdit `terraform.tfvars`, leave the `aws_profile` as `\"default\"`, and set `aws_region` to match your needs. \n\n### Terraform stack resources\n\nThe following resources will be created by terraform:\n\n- S3 buckets for terraform state and build artifacts - view it in the [S3 console](https://s3.console.aws.amazon.com/s3).\n- DynamoDB table for terraform state locking - view it in the [DynamoDB console](https://s3.console.aws.amazon.com/dynamodb).\n- ALB - view it in the [EC2 console](https://console.aws.amazon.com/ec2).\n- ECS cluster - view it in the [ECS console](https://console.aws.amazon.com/ecs).\n- ECR container registry - view it in the [ECR console](https://console.aws.amazon.com/ecr).\n- CodeCommit git repo - view it in the [CodeCommit console](https://console.aws.amazon.com/codecommit).\n- CodeBuild project - view it in the [CodeBuild console](https://console.aws.amazon.com/codebuild).\n- CodePipeline build pipeline - view it in the [CodePipeline console](https://console.aws.amazon.com/codepipeline).\n- CodeDeploy blue/green deployment - view it in the [CodeDeploy console](https://console.aws.amazon.com/codedeploy).\n\n### Local Git setup\n\nIn order to be able to interact with the CodeCommit repo created by this terraform stack, please make sure to setup your git installation appropriately. You will need to set the codecommit `credential-helper` for things to run smoothly.\n\n```bash\ngit config --global user.name \"John Doe\" # you might have set this up already\ngit config --global user.email jdoe@thisismyemail.com # same here\ngit config --global credential.helper '!aws codecommit credential-helper $@'\ngit config --global credential.UseHttpPath true\n```\n\nYou should now be able to clone the CodeCommit Repo to a local directory of your choice. The repo URL can be found looking at the terraform outputs of the stack, see `source_repo_clone_url_http` or run `terraform output source_repo_clone_url_http`.\n\n**macOS users**: In case you encounter weird HTTP 403 errors when cloning, please look at any previously stored CodeCommit credentials in your Keychain Access app, and delete them.\n\n### Testing the application\n\nFrom the output of the Terraform build, note the Terraform output `alb_address_dev` (dev stage) and `alb_address_prod` (prod stage), or run `terraform output alb_address_\u003cstage\u003e`. With it, you should be able to access the application:\n- Perform a GET request against the `\u003cyour-alb-address-here\u003e/mountains` resource\n- Check out the Swagger UI by GETting the `\u003cyour-alb-address-here\u003e/swagger-ui.html` resource\n\n### Changing the application and retesting\n\nTesting the deployment process can best be tested by changing the application and observing how these end up in the respective stages. You can try this out by e.g. adding a mountain in the `MountainsController` class, and committing/pushing the change. This will trigger the following:\n\n- Automated deployment to the ECS dev cluster stage\n- Automated blue/green deployment to production. This requires a *manual approval* step in CodePipeline after the deployment to the dev stage completed successfully\n\n### Cleanup\n\nIn order to tear down the cluster, execute the following commands:\n\n```bash\ncd terraform/infrastructure\nterraform destroy\ncd terraform/initial-setup/remote-state\nterraform destroy\n```\n\nThe created S3 buckets might fail to delete if not empty. In this case, these need to be deleted manually.\n\n### Known issues and limitations\n\nDue to the fact that variables aren't supported in terraform's `backend` section (there's an open issue on that [here](https://github.com/hashicorp/terraform/issues/13022)), this project will cause a bucket name collision when being deployed more than once.\nYou can fix this by supplying an alternative backend state bucket name in `remote-state/main.tf` and adjust `infrastructure/main.tf` to reflect the change. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodecentric%2Faccelerate-kickstarter-aws","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodecentric%2Faccelerate-kickstarter-aws","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodecentric%2Faccelerate-kickstarter-aws/lists"}