Skip to main content

Cloudformation stack creation – scripting via bash

Find yourself creating the same AWS Cloudformation stack a lot during testing?
Wasting too much time repeating typing in tags?

A simple post today with a quick solution.

Put your stack tags and parameters into json files and use this bash wrapper script to create the cloudformation stack. This script wraps the aws cloudformation create-stack command, but lets you create the stacks again and again with different names. The benefit is the parameters and tags are pre-defined. Thus this script will save you time if you are doing this from the AWS console regularly.

An example of running the script with parameters (that are ordinal on purpose):

create-stack.sh MockStack3 deploy/MockServices.template stackParams.json stackTags.json

Provide your own template file, and modify the stackParams and stackTags to your own needs. Below you’ll find the GitHub gist of the script and sample json files.

Tested on Bash in Windows 10 insider preview 🙂