Bobcares

Delete Auto Scaling infrastructure in EC2 – How to do it

by | Aug 29, 2021

Want to delete Auto Scaling infrastructure in EC2? We can help you.

If we delete an Auto Scaling group, it terminates the instances. It also deletes any associated logs or data, and any volumes on the instance.

Here, at Bobcares, we assist our customers with several AWS queries as part of our AWS Support Services.

Today, let us see how we can delete the auto scalling infrastructure.

 

Delete Auto Scaling infrastructure in EC2

In case we do not want to terminate one or more instances, we can detach them before we delete the Auto Scaling group.

Delete via console:

  1. Initially, we open the Amazon EC2 Auto Scaling console.
  2. There, we can see a check box next to the Auto Scaling group, we select it and then select Delete.
  3. In case of a prompt for confirmation, we select Delete.
  4. A loading icon in the Name column indicates the deletion.

It will take a few minutes to terminate the instance and delete the group. To see the current state, we can refresh the list.

Delete via AWS CLI:

aws autoscaling delete-auto-scaling-group --auto-scaling-group-name my-asg

Suppose the group has instances or scaling activities in progress, then we use:

aws autoscaling delete-auto-scaling-group --auto-scaling-group-name my-asg --force-delete

 

(Optional) Delete the launch configuration

Moving ahead, our Support Techs discusses few options to delete. We can skip them to keep the launch template for future use.

Delete via console:

  1. First, we open the Amazon EC2 console.
  2. Then under AUTO SCALING, we select Launch Configurations.
  3. On that page, we select the launch configuration > Actions > Delete launch configuration.
  4. For confirmation, we select, Yes, Delete.

Delete via AWS CLI:

aws autoscaling delete-launch-configuration --launch-configuration-name my-launch-config

 

(Optional) Delete the launch template

It is possible for us to delete the launch template or just one version of the launch template.

Delete via console:

  1. Initially, we open the Amazon EC2 console.
  2. Then under INSTANCES, we select Launch Templates.
  3. We select the launch template and then do one of the following:
  4. Actions > Delete template > Delete launch template.
  5. Actions > Delete template version > Select the version > Delete launch template version.

Delete via AWS CLI:

aws ec2 delete-launch-template --launch-template-id lt-068f72b72934aff71

Alternatively, to delete a specific version of a launch template, we run:

aws ec2 delete-launch-template-versions --launch-template-id lt-068f72b72934aff71 --versions 1

 

(Optional) Delete the load balancer and target groups

Our Support Techs does not recommend this if the Auto Scaling group does not associate with an Elastic Load Balancing load balancer.

Delete load balancer via console:

  1. Firstly, we open the Amazon EC2 console.
  2. From under LOAD BALANCING, we select Load Balancers.
  3. Then we select the load balancer > Actions > Delete.
  4. Finally, for confirmation, we select Yes, Delete.

Delete target group via console:

  1. Under LOAD BALANCING, we select Target Groups.
  2. We select the target group and select Actions > Delete.
  3. For confirmation, we select Yes.

Delete the load balancer via AWS CLI:

For Application Load Balancers and Network Load Balancers, we use:

aws elbv2 delete-load-balancer --load-balancer-arn my-load-balancer-arn aws elbv2 delete-target-group --target-group-arn my-target-group-arn

For Classic Load Balancers, we use:

aws elb delete-load-balancer --load-balancer-name my-load-balancer

 

(Optional) Delete CloudWatch alarms

Suppose the Auto Scaling group does not associate with any CloudWatch alarms. Then we skip this section.

Delete via console:

  1. Initially, we open the CloudWatch console.
  2. Then we select Alarms on the navigation pane.
  3. After that, we select the alarms and then Action > Delete.
  4. For confirmation prompt, we select Delete.

Delete via AWS CLI:

Generally, we can delete one or more alarms at a time.

aws cloudwatch delete-alarms --alarm-name Step-Scaling-AlarmHigh-AddCapacity Step-Scaling-AlarmLow-RemoveCapacity

[Need help with any of the above steps? We are available 24*7]

 

Conclusion

In short, we saw how our Support Techs delete the auto scaling infrastructure.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.