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?
You can access the features of Amazon Elastic Compute Cloud (Amazon EC2) using the AWS Command Line Interface (AWS CLI).
Launch an EC2 instance using an Amazon Linux Amazon Machine Image (AMI). Linux AMIs come with the AWS CLI installed.
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.
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.
aws autoscaling detach-instances --instance-ids i-2a2d8978 --auto-scaling-group-name my-asg --should-decrement-desired-capacity
to delete the ASG
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With