I have a template for AWS Cloud Formation. In this template I have set several parameters. Now, what I would like to do is to leave a parameter field empty but allow the user to select a specific parameter for example a security group. Now what I would like to do is that if a user does not select anything (field stays empty) I want it to give an error message saying field required when you want to proceed and prevent the user from proceeding, as it happens when you do not enter a stack name (see screenshot below).

How do I do this for any parameter in a cloud formation template??? I have searched around but do not find anything regarding validation of user input …
I know I could set a default for everything, but I do not want to set a default and specifically force a user to make a selection in this case …
Please see this thread:
https://forums.aws.amazon.com/thread.jspa?threadID=230829
Suggested solution: simply use regular expressions in AllowedPattern.
For e.g. to have a non blank value:
"AllowedPattern" : ".+"
If you want the parameter to be alpha numeric:
"AllowedPattern" : "[a-zA-Z0-9]+"
To match an exact word:
"AllowedPattern" : "^my_matched_word$"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With