NEW Featured eBook: AWS Cloud Cost Allocation: The Complete Guide - Download Now

Delete Unused AWS EBS Volumes

EBS (Elastic Block Storage) volumes are attached to EC2 Instances as storage devices. Unused (Unattached) EBS Volumes can keep accruing costs even when their associated EC2 instances are no longer running.

This rule checks whether there are unused EBS Volumes in your AWS account. nOps recommends you consider deleting non-used EBS volumes to reduce your monthly AWS bills.

This rule can help you with the following:

Compliance frameworks report

  • SOC 2 Readiness Report 

AWS Well-Architected Lens

  • AWS Well-Architected Framework Lens

Audit

Carry out the following steps to find out if there are any unused EBS volumes in your cloud environment:

1. Sign in to the AWS Management Console to access the EC2 dashboard via https://console.aws.amazon.com/ec2/.

2. Navigate to the left panel and click the Volumes under the Elastic Block Store section.

3. Scroll horizontally to the State column to confirm the status of each EBS volume.

4. If a volume is marked as in-use, If a volume has an available state, it is currently unused (unattached) by any instance and may be safely deleted.

1. Run thedescribe-volumes command to find out if there are any unused EBS volumes in your cloud environment:

aws ec2 describe-volumes \\
--region us-east-1 \\
--filters Name=status,Values=available

2. A JSON Object containing configuration data for each detected unused EBS volume should be returned as output:

{
    "Volumes": [
        {
            "Attachments": [],
            "AvailabilityZone": "us-east-1d",
            "CreateTime": "2019-12-02T12:01:41.088000+00:00",
            "Encrypted": false,
            "Size": 8,
            "SnapshotId": "snap-09328b730a42039c6",
            **"State": "available",**
            "VolumeId": "vol-0b810c6c7e4a334cb",
            "Iops": 100,
            "Tags": [
                {
                    "Key": "Name",
                    "Value": "Ashish_ZF1"
                }
            ],
            "VolumeType": "gp2",
            "MultiAttachEnabled": false
        },
        {
            "Attachments": [],
            "AvailabilityZone": "us-east-1d",
            "CreateTime": "2019-12-13T04:20:57.505000+00:00",
            "Encrypted": false,
            "Size": 50,
            "SnapshotId": "snap-0415d8298c7099b66",
            **"State": "available",**
            "VolumeId": "vol-06d24eb6b77f09e70",
            "Iops": 150,
            "VolumeType": "gp2",
            "MultiAttachEnabled": false
        },
				...
        {
            "Attachments": [],
            "AvailabilityZone": "us-east-1d",
            "CreateTime": "2020-02-07T08:29:07.029000+00:00",
            "Encrypted": false,
            "Size": 80,
            "SnapshotId": "snap-0415d8298c7099b66",
            **"State": "available",**
            "VolumeId": "vol-012e179cf459c730e",
            "Iops": 240,
            "VolumeType": "gp2",
            "MultiAttachEnabled": false
        }
]

Remediation / Resolution

1. Sign in to the AWS Management Console to access the EC2 dashboard via https://console.aws.amazon.com/ec2/.

2. Navigate to the left panel and click the Volumes under the Elastic Block Store section. (Similarly to what we did in the Audit section).

3. Select the unused volume you intend to delete.

5. (Optional) Create a snapshot of your volume:

a. Select the Actions button and choose the Create Snapshot option:

Delete Unattached EBS Volumes AWS

b.  Fill in the description in the resulting box and click Create

6. To delete the unused volume, click the Actions button again and choose the Delete Volume option:

7. Confirm the deletion in the popup box.

1. Execute the describe-volumes command which retrieves all unused EBS volumes.

aws ec2 describe-volumes \\
--region us-east-1 \\
--filters Name=status,Values=available

2. Again, a JSON Object containing configuration data for each detected unused EBS volume should be returned as output

{
    "Volumes": [
        {
            "Attachments": [],
            "AvailabilityZone": "us-east-1d",
            "CreateTime": "2019-12-02T12:01:41.088000+00:00",
            "Encrypted": false,
            "Size": 8,
            "SnapshotId": "snap-09328b730a42039c6",
            **"State": "available",**
            "VolumeId": "vol-0b810c6c7e4a334cb",
            "Iops": 100,
            "Tags": [
                {
                    "Key": "Name",
                    "Value": "Ashish_ZF1"
                }
            ],
            "VolumeType": "gp2",
            "MultiAttachEnabled": false
        },
        {
            "Attachments": [],
            "AvailabilityZone": "us-east-1d",
            "CreateTime": "2019-12-13T04:20:57.505000+00:00",
            "Encrypted": false,
            "Size": 50,
            "SnapshotId": "snap-0415d8298c7099b66",
            **"State": "available",**
            "VolumeId": "vol-06d24eb6b77f09e70",
            "Iops": 150,
            "VolumeType": "gp2",
            "MultiAttachEnabled": false
        },
				...
        {
            "Attachments": [],
            "AvailabilityZone": "us-east-1d",
            "CreateTime": "2020-02-07T08:29:07.029000+00:00",
            "Encrypted": false,
            "Size": 80,
            "SnapshotId": "snap-0415d8298c7099b66",
            **"State": "available",**
            "VolumeId": "vol-012e179cf459c730e",
            "Iops": 240,
            "VolumeType": "gp2",
            "MultiAttachEnabled": false
        }
]

3. Next, run the delete-volume command along with the volume ID of the EBS volume you intend to delete. Below is a sample delete-volume command:

aws ec2 delete-volume \\
--region us-east-1 \\
--volume-id vol-012e179cf459c730e

4. To confirm the selected EBS volume has been deleted, re-run the describe-volumes command while specifying the volume-id:

aws ec2 describe-volumes \\
--region us-east-1 \\
--volume-id vol-e323363d

5. The command should return a volume not found error.

A client error (InvalidVolume.NotFound) occurred when calling the DescribeVolumes operation: The volume 'vol-e323363d' does not exist.

Still Need Help?

Come see why we are the #1 cloud management platform and why companies like Uber, Dickey’s BBQ Pit and Norwegian Cruise Line trust nOps to manage their cloud.