Blossom Logo Deploy your apps with Blossom — Get Started
BoltOps Logo
Summarize CloudFormation Required Parameters with jq header image

Summarize CloudFormation Required Parameters with jq

Tung Nguyen Tung Nguyen · September 17, 2017
1 min read

Shortly after the last video CloudFormation Templates and jq Tips, I wanted to know what the required parameters in a CloudFormation template were. This is also an easy task with jq. I’ll show you how to use jq to quickly summarize the required and optional parameters in a CloudFormation template in this post. It’s a one-liner 😁

First, we’ll download a sample template:

wget "https://s3.amazonaws.com/cloudformation-templates-us-east-1/EC2InstanceWithSecurityGroupSample.template"
mv EC2InstanceWithSecurityGroupSample.template ec2.json

To list the required parameters:

$ cat ec2.json | jq -r '.Parameters | to_entries | .[] | select(.value.Default == null) | .key'
KeyName

To list the optional parameters:

$ cat ec2.json | jq -r '.Parameters | to_entries | .[] | select(.value.Default != null) | .key'
InstanceType
SSHLocation

Hope you found this helpful. 🎉 This is also even shorter and sweeter with lono inspect summary.

Related Posts:

Blossom Logo
Deploy Your Apps with Ease

Blossom helps you and your AI agent deploy apps and keep them running. Start on managed Blossom Cloud or connect your own cloud account.

BoltOps Blog
Join a group of good-looking folks who get free email updates from BoltOps.