Summarize CloudFormation Required Parameters with jq
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:
Thanks for reading this far. If you found this article useful, I'd really appreciate it if you share this article so others can find it too! Thanks 😁 Also follow me on Twitter.
Got questions? Check out BoltOps.
You might also like
More tools:
-
Kubes
Kubes: Kubernetes Deployment Tool
Kubes is a Kubernetes Deployment Tool. It builds the docker image, creates the Kubernetes YAML, and runs kubectl apply. It automates the deployment process and saves you precious finger-typing energy.
-
Jets
Jets: The Ruby Serverless Framework
Ruby on Jets allows you to create and deploy serverless services with ease, and to seamlessly glue AWS services together with the most beautiful dynamic language: Ruby. It includes everything you need to build an API and deploy it to AWS Lambda. Jets leverages the power of Ruby to make serverless joyful for everyone.
-
Lono
Lono: The CloudFormation Framework
Building infrastructure-as-code is challenging. Lono makes it much easier and fun. It includes everything you need to manage and deploy infrastructure-as-code.