Monday, March 15, 2021

AWS - HowTo - How to automate "Delete unused EBS Volumes" from AWS Systems Manager

 


In this blog post, let us see how to automate the task of deleting unused volumes in an automated way, using AWS Systems Manager

Pre-requisite:

  • An active AWS acocunt
  • Permissions to use AWS Systems Manager & EC2 Management Console 

Steps:

  • Login & Navigate to AWS EC2 management console
  • Identify an EBS volume which stays unused in any of the EC2 instances
  • Now, navigate to AWS Systems Manager -> Automation -> Execution option
  • From the options listed, select "AWS-DetachEBSVolume" option
  • Take a look and double check the volume id's status before starting the SSM automation

  • Supply the "Volume Id", select a "Role ARN" which is required to assume the role and perform the automation

  • set the optional "create snapshot" value as required; "false" in our use case here
  • Now watch the progress of EBS volume id given is being detected if it is used against any EC2 Instances or not and then getting deleted

  • Look out for the Volume of 1GB created for testing purposes is no longer available



Note:

  • The automation while being done for on volume here might look so simple, but imagine if the account has lot of volumes created randomly and then time comes when they have to be cleanup automatically

No comments:

Post a Comment