Error parsing AWS CloudFormation template
I’ve gotten this error a few times now while running a CloudFormation script. I suppose it is passing up the lower level error from YAML:
while parsing a block mapping
in "<unicode string>", line 5, column 1:
Parameters:
^ (line: 5)
expected <block end>, but found '<block mapping start>'
in "<unicode string>", line 10, column 2:
GroupDescriptionParam:
^ (line: 10)
The error message at least gives you a lot of good clues. It tells you precisely what line the problem is on and the element causing the problem. It’s a stack trace so I think really we only need the second block of the error message here, but I can see in my case the problem is with GroupDescriptionParam.
That’s a great clue and it is, in fact, on line 10 in my template. Great. So what’s the actual problem?

I have a colon after the parameter name. The types look correct. If you’re younger than me with very good eyesight you might spot it right away but the first time I got this error it took me a bit to see it. Now I recognize the error message.
I need a space before the parameter name to align it with the others:

The littlest things like that can sometimes trip you up and waste time when the error message isn’t clear. When you get a similar error in Python, it tells you, “Hey, you have an indentation error.” It would be nice if CloudFormation would do the same thing here regardless of what YAML reports.
At any rate…another bug resolved in my code at least. Hope that helps someone else.
Teri Radichel
If you liked this story please clap and follow:
Medium: Teri Radichel or Email List: Teri Radichel
Twitter: @teriradichel or @2ndSightLab
Requests services via LinkedIn: Teri Radichel or IANS Research
© 2nd Sight Lab 2022
____________________________________________
Author:
Cybersecurity for Executives in the Age of Cloud on Amazon

Need Cloud Security Training? 2nd Sight Lab Cloud Security Training
Is your cloud secure? Hire 2nd Sight Lab for a penetration test or security assessment.
Have a Cybersecurity or Cloud Security Question? Ask Teri Radichel by scheduling a call with IANS Research.
Cybersecurity & Cloud Security Resources by Teri Radichel: Cybersecurity and Cloud security classes, articles, white papers, presentations, and podcasts
