Identifying and Deleting Orphaned Amazon EC2 AMIs and Snapshots

You can use the Amazon EC2 Orphaned Resource Utility to list and delete Commvault-created, orphaned Amazon Machine Images (AMIs) and Amazon EBS snapshots.

Caution

The utility assumes that you have a single AWS account that is protected by a single CommServe server.

If your AWS account is protected by multiple CommServe servers, then the utility might delete EBS snapshots that are registered with other CommServe servers.

Unsupported Services

The Amazon EC2 Orphaned Resource Utility identifies and deletes only orphaned AWS compute resources. It does not support the following services:

  • Amazon Aurora

  • Amazon DocumentDB (with MongoDB compatibility)

  • Amazon RDS

  • Amazon RDS Custom

Prerequisites

  • The following permissions are required:

    • ec2:DescribeImages

    • ec2:DeregisterImage

    • ec2:DeleteSnapshot

    • ec2:DescribeSnapshots

  • The following modules are required:

    • Python 3.10 or a more recent release

    • Boto3: AWS SDK for Python

    • pymssql: DB-API interface to Microsoft SQL Server

Utility Functions

The Amazon EC2 Orphaned Resource Utility performs the following functions:

  • Generate a report that lists the details for all orphaned AMIs and snapshots.

    Example

    python AmazonEC2OrphanedResourceUtilityv1.py --accessKey access_key --secretKey secret_key --region us-east-1 --deleteSnapshots False
  • Take the report as input and delete all the resources that are marked for deletion.

    Example

    python AmazonEC2OrphanedResourceUtilityv1.py --accessKey access_key --secretKey secret_key --region us-east-1 --deleteSnapshots true --orphanedSnapshotsReport file_name.csv
  • Generate a report and delete all the orphaned AMIs and snapshots.

    Example

    python AmazonEC2OrphanedResourceUtilityv1.py --accessKey access_key --secretKey secret_key --region us-east-1 --deleteSnapshots true --mode orphanedCVIntelliSnaps --commServeDbHostname commserver_hostName --commServeDbUserName DB_usernamename --commServeDbPassword DB_password

Utility Modes

The Amazon EC2 Orphaned Resource Utility has the following modes:

  • orphanedCVSnaps: Applies to streaming backup operations

  • integritySnaps: Applies to replication operatons

  • orphanedCVIntelliSnaps: Applies to snapshot operations

×

Loading...