Aws / Get Backup Plan Details
Get Backup Plan Details
Retrieve details of a specific backup plan in AWS Backup.
aws backup get-backup-plan --backup-plan-id <id> aws backup get-backup-plan --backup-plan-id <id> #!/bin/bash
# Get Backup Plan Details
aws backup get-backup-plan --backup-plan-id {{id}} import subprocess
# Get Backup Plan Details
# Make sure to replace <placeholders> with actual values
def run_command():
cmd = [
"aws",
"backup",
"get-backup-plan",
"--backup-plan-id",
"<id>"
]
try:
print(f"Executing: {' '.join(cmd)}")
subprocess.run(cmd, check=True)
except subprocess.CalledProcessError as e:
print(f"Error: {e}")
except FileNotFoundError:
print("Error: aws not found. Please install it first.")
if __name__ == "__main__":
run_command() When To Use
When performing a full audit of backup strategy or troubleshooting backup failures.
Pro Tip
Combine with `--query` to extract specific elements like 'BackupPlanName' for quicker analysis.
Command Builder
Tune the command before you copy it
aws backup get-backup-plan --backup-plan-id <id> Terminal Output
Expected runtime feedback
{
"BackupPlan": {
"BackupPlanId": "12345",
"BackupPlanName": "DailyBackup",
"Rules": [
{
"RuleName": "DailyBackupRule",
"TargetBackupVaultName": "MyVault",
"ScheduleExpression": "cron(0 12 * * ? *)"
}
]
}
} Anatomy of Output
Understanding the result
BackupPlanId: 12345678-90ab-cdef-ghij-klmnopqrstuv Plan Identifier Unique ID for the backup plan.
BackupPlanName: daily-backup-plan Plan Name The name of the backup plan.
BackupPlanStatus: ACTIVE Current Status Indicates the operational state of the backup plan.
Troubleshooting
Common pitfalls
An error occurred (ResourceNotFoundException) when calling the GetBackupPlan operation: Backup plan not found: id: 12345678-90ab-cdef-ghij-klmnopqrstuv.
Solution: Verify the Backup Plan ID and ensure it exists in the specified region.
An error occurred (AccessDeniedException) when calling the GetBackupPlan operation: You are not authorized to perform this action.
Solution: Check IAM policy for sufficient permissions to access backup plans.
An error occurred (ValidationException) when calling the GetBackupPlan operation: Invalid backup plan ID.
Solution: Confirm the backup plan ID format and retry the operation.
Command Breakdown
What each part is doing
-
aws - Base Command
- The executable that performs this operation. Here it runs Aws before the shell applies any redirect operators.
-
<id> - id
- The value supplied for id.
-
--backup-plan-id - Command Option
- Tool-specific option used by this command invocation.
How To Run
Execution path
- Step 1
Run the command: aws backup get-backup-plan --backup-plan-id {{id}}
- Step 2
Verify the output contains the expected BackupPlanId and BackupPlanName.
Alternative Approaches
Comparable commands in other tools
Alternative cloud infrastructure tools for the same job.