DEV Community

Cover image for Building an Automated AWS Backup and Disaster Recovery Solution Using AWS Backup
Narendra Sivangula
Narendra Sivangula

Posted on

Building an Automated AWS Backup and Disaster Recovery Solution Using AWS Backup

1. Introduction

A backup is useful only when its data can be restored and validated. A successful backup job alone does not prove that a workload can recover.

This project provisions an EC2 instance and an encrypted EBS data volume, protects the volume with AWS Backup, creates an on-demand recovery point, restores that recovery point as a separate EBS volume, attaches it to the instance, and validates the recovered file. Terraform provisions the infrastructure.

Scope and accuracy: This project completed a backup restoration test. It did not simulate an outage or delete the original data before restoring. The original and restored volumes were mounted separately and their validation-file contents were compared. An EventBridge rule and SNS target were configured for failed backup jobs, but no deliberate failure was generated to test event delivery. No email subscription was configured.

Project: AWS Community Builders -- Article 10
Region: ap-south-2 (Hyderabad)
Infrastructure as Code: Terraform
Recovery Method: Restore an AWS Backup recovery point as a new EBS volume
Repository: AWS Community Builder Repository

2. Goals

  • Provision repeatable infrastructure using Terraform.
  • Encrypt the EBS data volume.
  • Select the volume for backup using a resource tag.
  • Configure a daily backup plan and seven-day lifecycle retention.
  • Trigger an on-demand backup for immediate validation.
  • Route failed backup job state-change events through EventBridge to SNS.
  • Restore a recovery point as a new EBS volume.
  • Validate the recovered filesystem and file without overwriting the original.

3. Architecture

The design includes an EC2 instance, an encrypted EBS data volume tagged Backup=Enabled, an AWS Backup vault and plan, tag-based backup selection, an EventBridge failure-event rule, and an SNS topic. Systems Manager Session Manager provides administration without an inbound SSH rule.

The backup plan is scheduled daily at 01:00 UTC with a 7-day lifecycle retention setting. An on-demand backup was also run so the restore test did not need to wait for the next scheduled execution.

4. Services Used

AWS Service Role
Amazon EC2 Test Linux instance
Amazon EBS Encrypted data volume being protected
AWS Backup Vault, plan, selection, backup job, recovery point, and restore job
IAM EC2 Systems Manager and AWS Backup service permissions
Amazon EventBridge Matches FAILED, ABORTED, and EXPIRED AWS Backup job state changes
Amazon SNS Receives events from the EventBridge target; no email subscription
AWS Systems Manager Shell access through Session Manager
Terraform Infrastructure provisioning

5. Terraform Implementation

The Terraform configuration uses the AWS provider in ap-south-2, discovers the default VPC/subnet and an Amazon Linux 2023 AMI, and provisions the EC2 instance and data volume.

The data disk is a 2 GiB encrypted gp3 EBS volume tagged:

Backup=Enabled
Enter fullscreen mode Exit fullscreen mode

The AWS Backup selection uses this tag. The EC2 instance has an instance profile with AmazonSSMManagedInstanceCore. Its security group has no inbound SSH rule. The instance user-data initializes the new empty data volume with XFS, mounts it at /data, and creates backup-validation.txt.

Note: The initialization/formatting step is intended only for the newly created empty lab volume. Never format a volume that contains data you need to preserve.

Deploy from the project root:

terraform -chdir=terraform init
terraform -chdir=terraform fmt -check
terraform -chdir=terraform validate
terraform -chdir=terraform plan
terraform -chdir=terraform apply
Enter fullscreen mode Exit fullscreen mode

6. Backup Plan and Recovery Point

The backup plan contains a daily rule scheduled for 01:00 UTC and a seven-day lifecycle retention setting. Its tag-based selection protects resources carrying Backup=Enabled.

An on-demand backup was started against the EBS volume. The backup job completed and produced a recovery point in article-10-backup-vault.

Inspect recovery points via AWS CLI:

aws backup list-recovery-points-by-backup-vault \
  --backup-vault-name article-10-backup-vault \
  --region ap-south-2
Enter fullscreen mode Exit fullscreen mode

Inspect the backup job:

aws backup describe-backup-job \
  --backup-job-id <BACKUP_JOB_ID> \
  --region ap-south-2
Enter fullscreen mode Exit fullscreen mode

7. Failure-Event Routing

An EventBridge rule matches AWS Backup job state-change events for FAILED, ABORTED, and EXPIRED states. The rule target is the project's SNS topic.

The SNS topic has no email subscription. The rule and target configuration were reviewed, but an intentional failed backup job was not generated. Therefore, this project does not claim an end-to-end notification delivery test.

8. Restore Workflow

AWS Backup restored the completed recovery point as a new EBS volume, leaving the original volume untouched. The restore was configured for the same Availability Zone as the EC2 instance: ap-south-2b.

The restore job completed and created:

Restored volume: vol-0923e8f2e687e5a4a
Original volume: vol-05c1d59806aa0bfae
Enter fullscreen mode Exit fullscreen mode

The restored volume was attached to the EC2 instance and appeared as /dev/nvme2n1.

9. Validate Recovered Data

The original volume was mounted at /data. The restored volume contained an XFS filesystem with the same filesystem UUID as the original. The initial mount attempt failed, and the kernel log reported a duplicate XFS UUID. This is expected when mounting a block-level clone alongside the original filesystem.

The restored volume was mounted read-only using XFS's nouuid option:

sudo mkdir -p /mnt/recovered
sudo mount -o ro,nouuid /dev/nvme2n1 /mnt/recovered
Enter fullscreen mode Exit fullscreen mode

The original and restored files were compared:

cat /data/backup-validation.txt
cat /mnt/recovered/backup-validation.txt
Enter fullscreen mode Exit fullscreen mode

Both contained:

Article 10 backup validation file
Sat Nov 28 14:10:41 UTC 2026
Enter fullscreen mode Exit fullscreen mode

The restored filesystem was mounted read-only to protect the recovered copy during validation.

10. RPO and RTO

Recovery Point Objective (RPO) is the maximum acceptable data-loss interval. With a daily backup schedule, the potential recovery point gap can approach the interval between successful backups. Actual RPO depends on the schedule, job completion, and workload write activity.

Recovery Time Objective (RTO) is the target time to restore service. This lab did not measure a production RTO. A real measurement would include detection, decision-making, restore duration, volume attachment, filesystem mounting, application validation, and service recovery.

A successful EBS restore demonstrates that the selected data can be recovered. It does not, by itself, prove application-level recovery or a specific RPO/RTO.

11. Repository Verification Artifacts

Along with the screenshots embedded throughout this walkthrough, raw JSON outputs exported from the AWS CLI are stored in the project repository for verification:

evidence/results/
├── backup-job.json
├── restore-job.json
├── backup-plan.json
├── recovery-points.json
└── volumes.json
Enter fullscreen mode Exit fullscreen mode

12. Security and Cost Considerations

The lab uses encrypted EBS storage, IAM roles, no inbound SSH rule, and Session Manager access. The project uses the AWS Backup vault's configured encryption behavior; verify the actual KMS key and key policy when adapting the design.

This setup is not guaranteed to fall completely under the AWS Free Tier. EC2 runtime, EBS storage, backup storage/recovery points, and related services can incur charges. Check current regional pricing and clean up the lab when finished.

13. Cleanup

The project includes scripts/destroy.sh. Before running it, save required evidence and verify the AWS account, region, vault contents, and restored volume ID. The script deletes recovery points in the named project vault, deletes the known separately restored EBS volume, and then runs terraform destroy for resources tracked in the project state.

14. Conclusion

This project demonstrates a repeatable AWS Backup workflow: provision encrypted EBS storage, select it by tag, create a backup, inspect the recovery point, restore it as a new EBS volume, and validate the recovered file. It also configures EventBridge-to-SNS routing for failed backup job events.

The key operational lesson is that backup completion and recoverability are different checks. A restore test and validation of the restored data provide stronger evidence that a recovery point is usable.

Top comments (0)