I have codepipeline that creates an AMI and I have created separate Cloudformation stack to create Launch template that uses the AMI. Currently the Launch Template Cloudformation has the AMI imageID hard-coded like this
LaunchTemplate:
Type: AWS::EC2::LaunchTemplate
Properties:
LaunchTemplateData:
ImageId: ami-xxxxxxxxxxxxxxx
What's the best way to update LaunchTemplate to always use the latest imageId built by codepipe line?
Use
This way CFN will fetch the latest AMI ID from SSM
Then use this parameter in