CloudFormation Template and jq Tips Summarize Resources

September 17, 2017

AWS CloudFormation Templates and jq Tips. In this video, I'll show you how to use jq to quickly summarize what resources are defined in a CloudFormation template. I found this to be useful to help understand how a CloudFormation template works.

Commands:

cat autoscaling.json | jq '.'
cat autoscaling.json | jq 'keys[]'
cat autoscaling.json | jq --compact-output '. | leaf_paths' | sed -e 's/,[0-9][0-9]*,/,1000,/g' | sed -e 's/,[0-9][0-9]*\]/,1000\]/g' | sort -u
cat autoscaling.json | jq '.Resources'
cat autoscaling.json | jq '.Resources | to_entries'
cat autoscaling.json | jq -r '.Resources | to_entries | .[].value.Type' | sort | uniq -c | sort -r

Get full access to these great resources

All for less than the price of coffee a day

44 courses
286 lessons
46+ hours

Get started with BoltOps Learn now and get access to easy and powerful lessons

BoltOps Tools