Get all AWS Backup recovery points grouped by resource name across all profiles and regions

By Saad Khamis

June 14, 2024

19714 views

In this blog I will share one way to get all AWS Backup recover points grouped by resource name across all profiles and regions including backup vault name, resource name, resource type and recovery points count. You can either display the result, export it to a file, or both.

Explore my other articles about AWS services:

Introduction

Within the AWS Management Console, use AWS Backup to get a list of available backup recovery points for a specific account and a specific region. To get AWS Backup resources across multiple AWS accounts, use instructions included in Managing AWS Backup resources across multiple AWS accounts.

I needed a summary list of resources recover points across all profiles and regions grouped by resource name. Hence, use PowerShell and AWS Tools for PowerShell to accomplish this task.

AWS Backup recover points grouped by resource name

Prerequisites

  1. Install and configure AWS Tools for PowerShell.
  2. Log in to all required AWS accounts/profiles.
  3. Set your IAM permissions to allow access to the required resources.

PowerShell Cmdlets

  1. Get-BAKRecoveryPointsByBackupVaultList Returns detailed information about the recovery points stored in a backup vault.
  2. Group-Object Groups objects that contain the same value for specified properties.
  3. Get-BAKBackupVaultList Returns a list of recovery point storage containers along with information about them.
  4. Get-ACCTRegionList Lists all the Regions for a given account and their respective opt-in statuses. Optionally, filter this list by the region-opt-status-contains parameter.
  5. Get-AWSCredential Returns an AWSCredentials object initialized from either credentials currently set as default in the shell or saved and associated with the supplied name from the local credential store.

Get recovery points stored in a backup vault

First, I used Get-BAKRecoveryPointsByBackupVaultList cmdlet to get a list of recovery points stored in a backup vault.

Group backup recovery points by resource name

Second, we group returned backup recovery points by resource name by using Group-Object and sort by resource name. Note: we used -NoElement to omit viewing group members, only for now.

Build required output

Third, we need to build required output “Profile”, “Region”, “BackupVaultName”, “Name”, “ResourceType”, “ResourceId”, “State” and “Count”. Since backup recovery points are grouped by resource name, each group members are for the same resource, hence the usage of Group[0].

Backup recovery points across all backup vaults

Fourth, we need to query for recovery points across all backup vaults and run the above commands for each.

Backup recovery points across all backup vaults across all supported regions

Fifth, we get a list of enabled region for the current account then repeat the above commands.

Backup recovery points across all backup vaults across all supported regions for all profiles

Finally, we get a list of existing profiles then repeat the above commands.

Conclusion

Can you believe it? You’ve made it to the end of this blog. The code may be challenging, difficult or lengthy but you have made it. Congratulations.

I used PowerShell and AWS Tools for PowerShell to get recovery points grouped by resource name across all profiles and regions. You can either display the result, export it to a file, or both.

Did you find this blog easy to follow and helpful to you? I certainly would love to hear your feedback and suggestions. So, let me know in the comments below. Happy PowerShelling.

Disclaimer

Purpose of the code contained in blog is solely for learning and demo purposes. Author will not be held responsible for any failure or damages caused due to any other usage.

Comments

There's no comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

List all AWS Certificate Manager certificates

By Saad Khamis 14083 views July 31, 2024

Get all AWS EBS snapshots across all profiles and regions

By Saad Khamis 18441 views June 26, 2024

Get all AWS EC2 instances across all profiles and regions

By Saad Khamis 33192 views November 27, 2023