Question:
Amazon AWS allows you to create Launch Configurations to be used with auto scaling groups.
However how can you spin-up up an individual instance instance based on a launch configuration?
Answer:
You will have to create an ASG in order to create an instance from a launch config, following is the command. Change min, max and desired capacities as per your needs. Refer the doc.
1 2 |
aws autoscaling create-auto-scaling-group --auto-scaling-group-name my-auto-scaling-group --launch-configuration-name my-launch-config --min-size 0 --max-size 1 --desired-capacity 1 --vpc-zone-identifier subnet-41767929c |
once the instance is launched you can detached the instance and delete the ASG.
1 2 |
aws autoscaling detach-instances --instance-ids i-2a2d8978 --auto-scaling-group-name my-asg --should-decrement-desired-capacity |
to delete the ASG
1 2 |
aws autoscaling delete-auto-scaling-group --auto-scaling-group-name my-asg |
However pls check your requirement again and this is NOT a recommended way to do things in AWS. Use a service like Cloud formation instead.