Removing Unattached EBS Volumes

Length: 00:08:06

Lesson Summary:

Deleting detached EBS volumes on a regular basis can help lower your AWS bill. In this lesson, we'll demonstrate a technique for deleting unattached EBS volumes across regions with Lambda, Boto3, and a CloudWatch rule.

Download the full source code for this lesson here.

Changing the root volume of an EC2 instance to persist:

aws ec2 modify-instance-attribute --instance-id i-1234567890abcdef0 --block-device-mappings file://mapping.json`

JSON file (remember to replace the value for DeviceName with the correct value for your device name):

  "DeviceName": "/dev/xvda",
  "Ebs": {
    "DeleteOnTermination": false

This lesson is only available to Linux Academy members.

Sign Up To View This Lesson

Or Log In

Looking For Team Training?

Learn More