How To Create A Backup Report In AWS Backup
Hello Everyone
Welcome to CloudAffaire and this is Debjeet.
You can use AWS Backup audit manager reports to find out the backup job status and the resources being backed up. The backup reports can be generated based on a schedule or ad-hoc basis and are stored in a S3 bucket in CSV or JSON format. You can configure a backup audit manager report on backup, restore and copy jobs. In order to create a backup report, first you need to define a backup report plan which contains the backup report configuration. You can have maximum 20 report plan per account. In this blog post, we will discuss how to create a backup report in AWS backup service.
How To Create A Backup Report In AWS Backup:
Prerequisites:
- AWS CLI installed and configured with proper access. You can use below link to install and configure AWS CLI.
https://cloudaffaire.com/how-to-install-aws-cli/
https://cloudaffaire.com/how-to-configure-aws-cli/
Step 1: Create a S3 bcuket with proper bucket policy to store your backup reports.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
## ------------------------------------------ ## Create a S3 bucket to store backup reports ## ------------------------------------------ ## Create the S3 bucket aws s3api create-bucket \ --bucket s3-for-backup-reports \ --region ap-south-1 \ --create-bucket-configuration LocationConstraint=ap-south-1 ## Create a bucket policy definition file for config ACCOUNT_ID=$(aws sts get-caller-identity | jq -r .Account) && cat < { "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Principal":{ "AWS":"arn:aws:iam::$ACCOUNT_ID:role/aws-service-role/reports.backup.amazonaws.com/AWSServiceRoleForBackupReports" }, "Action":"s3:PutObject", "Resource":[ "arn:aws:s3:::s3-for-backup-reports/*" ], "Condition":{ "StringEquals":{ "s3:x-amz-acl":"bucket-owner-full-control" } } } ] } EOF ## Create a S3 bucket policy for Config aws s3api put-bucket-policy \ --bucket s3-for-backup-reports \ --policy file://report_bucket_policy.json |
Step 2: Create a backup report plan.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
## -------------------- ## Create A Backup Plan ## -------------------- ## Create a backup report plan aws backup create-report-plan \ --report-plan-name mybackupreport \ --report-plan-description mybackupreport \ --report-delivery-channel 'S3BucketName=s3-for-backup-reports,S3KeyPrefix=ap-south-1,Formats=CSV' \ --report-setting 'ReportTemplate=BACKUP_JOB_REPORT' ## List all reports plan aws backup list-report-plans ## Get report plan details aws backup describe-report-plan \ --report-plan-name mybackupreport |
We have successfully created a new backup plan.
Next, we will trigger a on-demand backup report job to generate a new backup report.
Step 3: Create a backup report.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
## ---------------------- ## Create A Backup Report ## ---------------------- ## Create a on-demand backup report aws backup start-report-job \ --report-plan-name mybackupreport ## List report job aws backup list-report-jobs ## Check if report uploaded to S3 bucket aws s3api list-objects \ --bucket s3-for-backup-reports \ --prefix "ap-south-1" |
The backup report cuccessfully created.
You can now download the backup report form S3 bucket.
Next, we will delete all the resources deployed in this demo.
Step 4: Clean up.
1 2 3 4 5 6 7 8 9 10 11 |
## ------- ## Cleanup ## ------- ## Delete the backup report plan aws backup delete-report-plan \ --report-plan-name mybackupreport ## Delete the S3 bucket with objects (reports) aws s3 rb \ s3://s3-for-backup-reports --force |
Hope you have enjoyed this article. To know more about AWS Backup, please refer below official documentation
https://docs.aws.amazon.com/aws-backup/index.html