Open menu
-->

Empty AWS Auto Scaling Groups

Cloud Conformity allows you to automate the auditing process of this resolution page. Register for a 14 day evaluation and check your compliance level for free!

Start a Free Trial Product features
Cost
optimisation

Identify any empty Auto Scaling Groups available within your AWS account and delete them in order to eliminate unneeded costs and suboptimal resources. An AWS ASG is considered empty when it doesn't have any EC2 instances attached and is not associated with an Elastic Load Balancer (ELB).

This rule resolution is part of the Cloud Conformity Base Auditing Package

As good practice, every empty Auto Scaling Group should be removed for cost optimization and better management of your AWS Auto Scaling components.

Audit

To identify any empty Auto Scaling Groups (ASGs), perform the following actions:

Using AWS Console

01 Sign in to the AWS Management Console.

02 Navigate to EC2 dashboard at https://console.aws.amazon.com/ec2/.

03 In the left navigation panel, under AUTO SCALING section, choose Auto Scaling Groups.

04 Select the AWS ASG that you want to examine.

05 Select Details tab from the dashboard bottom panel and verify the Load Balancers property value. If Load Balancers does not have a value set, e.g.

If Load Balancers does not have a value set

the selected ASG is not associated with an AWS Elastic Load Balancer, required to distribute the traffic across instances within the group.

06 Now select the Instances tab and verify if there are any EC2 instances currently attached. If there are no instances listed and the following status is displayed: “No instances running in this Auto Scaling group”:

No instances running in this Auto Scaling group

the selected Auto Scaling Group does not have any instances running within its auto scaling environment.

If both conditions are met, i.e. is not associated with an Elastic Load Balancer and it doesn't have any instances attached, the selected ASG should be marked as empty then safely removed from your account.

07 Change the AWS region from the navigation bar and repeat the audit process for other regions.

Using AWS CLI

01 Run describe-auto-scaling-groups command (OSX/Linux/UNIX) to list the names of the Auto Scaling Groups available within the selected AWS region:

aws autoscaling describe-auto-scaling-groups
	--region us-east-1
	--output table
	--query 'AutoScalingGroups[*].AutoScalingGroupName'

02 The command output should return a table with the requested ASG names:

---------------------------
|DescribeAutoScalingGroups|
+-------------------------+
|  MyWebAppASG            |
|  MyBackendASG           |
|  ProdCacheASG           |
+-------------------------+

03 Run describe-load-balancers command (OSX/Linux/UNIX) using the name of the ASG that you want to examine as identifier to expose the load balancers associated with it:

aws autoscaling describe-load-balancers
	--region us-east-1
	--auto-scaling-group-name MyWebAppASG

04 The command output should return the metadata of each load balancer added to the ASG:

{
    "LoadBalancers": []
}

If the LoadBalancers property returns an empty array as its value ( i.e. [ ] ), the selected ASG is not currently associated with an Elastic Load Balancer.

05 Run describe-auto-scaling-groups command (OSX/Linux/UNIX) to describe the selected AWS Auto Scaling Group configuration. The following command example provides information about an ASG named MyWebAppASG available in the US-East-1 region:

aws autoscaling describe-auto-scaling-groups
	--region us-east-1
	--auto-scaling-group-names MyWebAppASG

06 The command output should return the selected Auto Scaling Group configuration metadata:

{
    "AutoScalingGroups": [
        {
            ...

            "AutoScalingGroupName": "MyWebAppASG",
            "DefaultCooldown": 300,
            "MinSize": 1,
            "Instances": [],
            "MaxSize": 2,
            "VPCZoneIdentifier": "subnet-19e7cc6f,subnet-4c377014",

            ...
        }
    ]
}

If the Instances property returns an empty array as its value (as shown in the output example above), the selected ASG does not have any EC2 instances attached.

Based on the information returned at step no. 4 and 6, if the selected Auto Scaling Group is not associated with a load balancer and it doesn't have any instances assigned, it should be marked as empty then safely removed from your AWS account.

07 Repeat steps no. 3 – 6 to identify other empty ASGs available in the current region.

08 Repeat steps no. 1 – 7 to repeat the entire audit process for other AWS regions.

Remediation / Resolution

To remove empty AWS Auto Scaling Groups from your account, perform the following:

Using AWS Console

01 Sign in to the AWS Management Console.

02 Navigate to EC2 dashboard at https://console.aws.amazon.com/ec2/.

03 In the left navigation panel, under AUTO SCALING section, choose Auto Scaling Groups.

04 Select the empty Auto Scaling Group that you want to remove (see Audit section part I to identify the right group(s)).

05 Click on the Actions dropdown button from the dashboard top menu and choose Delete command to delete the selected ASG.

06 In the Delete Auto Scaling Group dialog box, review the resource details then click Yes, Delete to confirm the action.

07 Repeat steps no. 4 – 6 to remove other empty Auto Scaling Groups available in the current region.

08 Change the AWS region from the navigation bar and repeat the entire process for other regions.

Using AWS CLI

01 Run delete-auto-scaling-group command (OSX/Linux/UNIX) to delete any ineffective Auto Scaling Groups (see Audit section part II to identify your empty ASG(s)). The following command example removes an AWS Auto Scaling Group named MyWebAppASG available in the US-East-1 region (the command does not produce an output):

aws autoscaling delete-auto-scaling-group
	--region us-east-1
	--auto-scaling-group-name MyWebAppASG

02 Repeat step no. 1 to remove other empty ASGs available in the selected region.

03 Change the AWS region and repeat the entire process for other regions.

References

Publication date Aug 31, 2016