I'm trying to launch an ASG with Cloudformation for an already-launched EC2 instance using the Launch configuration property of InstanceId, in the AWS documentation says the following:
InstanceID The ID of the Amazon EC2 instance to use to create the launch configuration. When you use an instance to create a launch configuration, all properties are derived from the instance with the exception of BlockDeviceMapping and AssociatePublicIpAddress. You can override any properties from the instance by specifying them in the launch configuration.
However, when I try to use this property the cloudformation stack rollback because the imageID and other properties are not found in the template.
This is the part of the template where I describe my LaunchConfig:
Resources:
myLaunchConfig:
Type: AWS::AutoScaling::LaunchConfiguration
Properties:
InstanceId:
LaunchConfigurationName: JPMM-LaunchConfig
I'm not sure what is happening, since the InstanceId property should give all the other properties just like the documentation says
When I describe my launch configuration with the following properties it works:
Resources:
MyLaunchConfig:
Type: AWS::AutoScaling::LaunchConfiguration
Properties:
AssociatePublicIpAddress: true
InstanceId:
IamInstanceProfile:
ImageId:
InstanceType: t2.micro
KeyName:
LaunchConfigurationName: LaunchConfig-Test
SecurityGroups:
-
I'm not sharing with you the values of the properties for security purposes but I do put them in the template
Do you know how to implement this property of the LaunchConfiguration? or even it works? I haven't found information about someone using this property on internet. Please if someone know something I would really appreciate your help
Thanks in advance!