How do you use cfn-init within a LaunchTemplate? This is for EC2 instances, in an autoscaling group, for an ECS cluster.
Where does the Metadata section for the instance go and what is the --resource to pass to cnf-init ?
LaunchTemplate:
Type: AWS::EC2::LaunchTemplate
Properties:
LaunchTemplateName: !Sub ${AWS::StackName}-launch-template
LaunchTemplateData:
SecurityGroups:
- !Ref DMZSecurityGroup
- !Ref ECSSecurityGroup
UserData:
Fn::Base64:
!Sub |
#!/bin/bash -xe
yum update -y aws-cfn-bootstrap
/opt/aws/bin/cfn-init -v --stack ${AWS::StackName} --resource ??? --region ${AWS::Region}
yum -y update
My best guess for Metadata produces the error:
Property validation failure: [Encountered unsupported properties in {/LaunchTemplateData}: [Metadata]]