AWS Certified Cloud Practitioner

Sign Up Free or Log In to participate!

Comments in Cloudformation templates

In the practitioner course the comment was made that the lecture had a preference for json.  However were I work we use yaml mainly as yaml supports comments…

Is there a way to put comments in json cfn templates ?

1 Answers

Unfortunately, JSON language does not support comments within its syntax, it’s a pure-data format in the form of key-value pairs. If you would like to add something as comments, then your comments would be come data as well (and will be exposed if your JSON got queried, with JMESPath for example).

You can try something like this, if exposing comments as JSON data is not a problem:


{

    "_comment_": "Leave your comments here",

    "key1":"value1",

    ....

}
Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?