I have a cloudformation template that creates an EC2 launch template.
In the UserData section of the template I need to fetch a SSM secure parameter and expose it as an environment variable to initialise my VM. I am trying to use !Sub
but my output is not what I expect. Here's my sample code:
TestJenkinsMasterLaunchTemplate:
Type: 'AWS::EC2::LaunchTemplate'
UserData:
Fn::Base64: !Sub
- |
#!/bin/bash
echo ${azure_client_id}
- azure_client_id: '{{resolve:ssm-secure:/Jenkins/Production/AzureAdClientId:1}}'
The output in the /var/log/cloud-init-output.log
file is the template itself: {{resolve:ssm-secure:/Jenkins/Production/AzureAdClientId:1}}
.
How can I resolve the SSM parameter properly?