Home

Awesome

AWS CloudFormation Starterkit header

AWS CloudFormation Starterkit

The ultimate starter kit to create and deploy AWS CloudFormation stacks using the Rain tool, enabling rapid infrastructure deployment on your AWS account!

Intro

Welcome to the AWS CloudFormation Starterkit, designed to streamline your infrastructure setup using CloudFormation templates and the Rain tool. This repository provides a structured approach to managing your AWS resources as code, ensuring efficient and reliable deployments.

[!TIP] Unlock the full potention of your infrastructure - Partner with Us!

Features

Setup Guide

This project requires Python 3 and pip for managing dependencies.

To get started, follow these steps:

  1. Clone this repository:
git clone https://github.com/dannysteenman/aws-cloudformation-starterkit.git
cd aws-cloudformation-starterkit
  1. Install checkov, cfn-lint via pip & rain via homebrew:
brew install rain
pip install -r requirements.txt
  1. Run the provision-repo.sh script to generate the parameter and workflow files for your environment and in the repository with your AWS account information and the necessary variables for the OIDC provider.
./scripts/provision-repo.sh
  1. Validate your CloudFormation templates with cfn-lint and checkov using the provided script:
./scripts/validate.sh
  1. Deploy the oidc-provider CloudFormation stack using the deploy-templates.sh script:
./scripts/deploy-templates.sh

[!WARNING] Make sure that you have the required IAM role or user setup in your aws config file. Use a tool such as Granted to make accessing your AWS account via the CLI easier and more secure.

Now that you have successfully deployed the OIDC provider, you can use the following steps to configure your GitHub repository with the necessary variables, so that the CI/CD workflow can be used to deploy your CloudFormation stacks.

  1. Navigate to your repository's settings page on GitHub.
    1. In the left sidebar, click on "Secrets and variables".
    2. Click on "Actions" and then "New repository variable".
    3. add the following variables:

Note: Make sure to modify the values of the variables to match your specific account and region.

GitHub Repository Variables

You can now use the provided GitHub Actions workflows to deploy your CloudFormation stacks. Simply commit your changes to the main branch of your repository by adding new stacks to the ./templates folder and the workflow will automatically deploy your stacks.

Project Structure

This starter kit is organized to promote best practices in managing CloudFormation templates:

.
ā”œā”€ā”€ .cfnlintrc
ā”œā”€ā”€ .checkov.yml
ā”œā”€ā”€ .github
ā”‚  ā”œā”€ā”€ pull-request-template.md
ā”‚  ā””ā”€ā”€ workflows
      ā”œā”€ā”€ cfn-lint-scan.yml
ā”‚     ā”œā”€ā”€ checkov-scan.yml
ā”‚     ā””ā”€ā”€ cloudformation-deploy-test.yml
ā”œā”€ā”€ LICENSE
ā”œā”€ā”€ parameters
ā”‚  ā”œā”€ā”€ production
ā”‚  ā”‚  ā””ā”€ā”€ oidc-provider.yml
ā”‚  ā””ā”€ā”€ test
ā”‚     ā””ā”€ā”€ oidc-provider.yml
ā”œā”€ā”€ README.md
ā”œā”€ā”€ requirements.txt
ā”œā”€ā”€ scripts
ā”‚  ā”œā”€ā”€ provision-repo.sh
ā”‚  ā”œā”€ā”€ deploy-templates.sh
ā”‚  ā””ā”€ā”€ validate-templates.sh
ā””ā”€ā”€ templates
   ā””ā”€ā”€ oidc-provider.yml

Key Components

CI/CD Integration

This starter kit includes GitHub Actions workflows for automated validation and deployment. Customize the workflows in the .github/workflows/ directory to suit your CI/CD needs.

Checkov Scan: Automatically runs Checkov on your templates to catch security and compliance issues before deployment. CloudFormation Deploy Test: Deploys your CloudFormation stacks in a test environment to ensure everything works as expected.

Start adding CloudFormation templates

To start adding CloudFormation templates, simply add new files to the ./templates directory and commit them to the main branch of your repository to trigger the CI/CD workflow. The workflow will automatically deploy your stacks using the provided parameter files.

Here are a couple of repositories containing CloudFormation templates that you can use as a starting point:

Unlock the full potention of your infrastructure - Partner with us!

[!TIP] Supercharge Your AWS Infrastructure with Towards the Cloud. We ship well-architected, resilient, and cost-optimized AWS solutions designed to scale using Infrastructure as Code (IaC), tailoring cloud-native systems for businesses of all sizes.

Our Approach:

Why Choose Us:

Ready to elevate your Infrastructure?

<a href="https://towardsthecloud.com/contact"><img alt="Schedule your call" src="https://img.shields.io/badge/schedule%20your%20call-success.svg?style=for-the-badge"/></a>

<details><summary>ā˜ļø <strong>Discover more about my one-person business: Towards the Cloud</strong></summary> <br/>

Hi, I'm Danny ā€“ AWS expert and founder of Towards the Cloud. With over a decade of hands-on experience, I specialized myself in deploying well-architected, highly scalable and cost-effective AWS Solutions using Infrastructure as Code (IaC).

When you work with me, you're getting a package deal of expertise and personalized service:

My mission is simple: I'll free you from infrastructure headaches so you can focus on what truly matters ā€“ your core business.

Ready to unlock the full potential of AWS Cloud?

<a href="https://towardsthecloud.com/contact"><img alt="Schedule your call" src="https://img.shields.io/badge/schedule%20your%20call-success.svg?style=for-the-badge"/></a>

</details>

AWS CDK Starterkit

Looking for a more modern approach to managing your AWS infrastructure? Consider using the AWS CDK Starterkit for a tailored experience that leverages the full power of AWS CDK with TypeScript.

AWS CDK offers several advantages over traditional CloudFormation, such as improved developer experience through the use of familiar programming languages, higher abstraction with reusable constructs, and seamless integration with development workflows. These features make AWS CDK a highly recommended choice for more efficient and flexible infrastructure management.

Explore the AWS CDK Starterkit and start building your infrastructure with greater efficiency and flexibility today!

Acknowledgements

Special thanks to the creators of Rain, Checkov, and cfn-lint for their invaluable tools that make infrastructure management easier and more secure.

Author

Danny Steenman