There is no way to create own functions as well variables. But you can create custom resource (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/crpg-ref.html) that will implement logic of the user data generation.
AWS CloudFormation and Function Declarations
-
04-07-2022 - |
Question
Good day, I have an AWS CloudFormation template where I create some LaunchConfigurations that have the same UserData. This UserData is created from the parameters passed to the new Stack. My question is if is there a way to create a function or variable that has that UserData string created just once and pass it to all LaunchConfigurations?
I read this: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-fuctions-structure.html
But I don't know where I can declare them.
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow