How do I pass parameters input data to userdata in AWS cloudformation. Example: I have a parameter EnvType where I will pass "qa" as input to this parameter while running CFT. I want this parameter value "qa" to be read and pass to userdata so that I can write it it to instance disk.
Parameters: {
"EnvType": {
"Description": "Environment type",
"Type": "String",
"AllowedValues": [
"prod",
"qa"
]
}
I tried using this in user data as:
export STACK_TYPE='",
{
"Ref": "EnvType"
},
"'\n",
"echo \"$STACK_TYPE\" > stacktypes\n
Where I wanted to append this input of EnvType into a file named stacktypes in the instance.