Sunday, June 11, 2017

variable names in Fn::Sub syntax must contain only alphanumeric characters, underscores, periods, and colons

While trying to use an ImportValue the way specified on the web sites in the UserData section of a CloudFormation template I go this error:

A client error (ValidationError) occurred when calling the CreateStack operation: Template error: variable names in Fn::Sub syntax must contain only alphanumeric characters, underscores, periods, and colons

The error seems straightforward but it is not exactly accurate, because the UserData section also allows things like # for comments, single quotes, and other characters. I whittled it down to disallowing the curly braces I was attempting to use based on other web sites that are obviously incorrect.