Disaster Recovery Manual
AWS Cold DR Runbook with XReplicator
Full-width runbook for recovering EC2 workloads from XReplicator snapshots: restore OS/data disks to staging, create EBS snapshot, convert snapshot to AMI, launch DR VM, and attach restored data disks.
Workflow
- Restore OS and data disks to a DR staging host via XReplicator disk-level restore.
- Create EBS snapshot from restored OS disk.
- Register AMI from snapshot.
- Launch DR EC2 from AMI.
- Attach restored data volumes to DR EC2 and validate services.
Prerequisites
- Backup server reachable from DR landing zone.
- Staging EC2 with XReplicator agent already connected.
- Target EBS volumes attached with same sizes as source disks.
- No formatting or partition creation needed before restore.
CLI Commands
Run after XReplicator has restored disk contents to attached staging volumes.
Set variables
# Required variables
export AWS_REGION=us-east-1
export DR_AZ=us-east-1a
export SUBNET_ID=subnet-xxxxxxxx
export SG_ID=sg-xxxxxxxx
export KEY_NAME=dr-keypair
export IAM_PROFILE=dr-instance-profile
# Restored volumes on staging host (from XReplicator restore)
export RESTORED_OS_VOLUME=vol-0abc1111osdisk
export RESTORED_DATA_VOLUME_1=vol-0abc2222datadisk1
export RESTORED_DATA_VOLUME_2=vol-0abc3333datadisk2Create OS snapshot
# 1) Create snapshot from restored OS volume
OS_SNAP_ID=$(aws ec2 create-snapshot \
--region "$AWS_REGION" \
--volume-id "$RESTORED_OS_VOLUME" \
--description "DR OS snapshot from XReplicator restored disk" \
--tag-specifications 'ResourceType=snapshot,Tags=[{Key=Name,Value=dr-os-snapshot}]' \
--query 'SnapshotId' --output text)
echo "OS snapshot: $OS_SNAP_ID"
# 2) Wait for snapshot to complete
aws ec2 wait snapshot-completed \
--region "$AWS_REGION" \
--snapshot-ids "$OS_SNAP_ID"Snapshot to AMI conversion
# 3) Register AMI from OS snapshot
AMI_ID=$(aws ec2 register-image \
--region "$AWS_REGION" \
--name "dr-ami-$(date +%Y%m%d-%H%M%S)" \
--architecture x86_64 \
--root-device-name /dev/xvda \
--virtualization-type hvm \
--ena-support \
--block-device-mappings "DeviceName=/dev/xvda,Ebs={SnapshotId=$OS_SNAP_ID,VolumeType=gp3,DeleteOnTermination=true}" \
--query 'ImageId' --output text)
echo "AMI: $AMI_ID"
# Optional: wait until AMI is available
aws ec2 wait image-available \
--region "$AWS_REGION" \
--image-ids "$AMI_ID"Bring up DR VM from AMI
# 4) Launch DR VM from AMI
DR_INSTANCE_ID=$(aws ec2 run-instances \
--region "$AWS_REGION" \
--image-id "$AMI_ID" \
--instance-type m6i.large \
--subnet-id "$SUBNET_ID" \
--security-group-ids "$SG_ID" \
--key-name "$KEY_NAME" \
--iam-instance-profile Name="$IAM_PROFILE" \
--tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=dr-recovered-vm}]' \
--query 'Instances[0].InstanceId' --output text)
echo "DR instance: $DR_INSTANCE_ID"
aws ec2 wait instance-running \
--region "$AWS_REGION" \
--instance-ids "$DR_INSTANCE_ID"Attach restored data disks
# 5) Detach restored data volumes from staging host (if attached)
aws ec2 detach-volume --region "$AWS_REGION" --volume-id "$RESTORED_DATA_VOLUME_1"
aws ec2 detach-volume --region "$AWS_REGION" --volume-id "$RESTORED_DATA_VOLUME_2"
aws ec2 wait volume-available --region "$AWS_REGION" --volume-ids "$RESTORED_DATA_VOLUME_1" "$RESTORED_DATA_VOLUME_2"
# 6) Attach restored data volumes to DR VM
aws ec2 attach-volume \
--region "$AWS_REGION" \
--volume-id "$RESTORED_DATA_VOLUME_1" \
--instance-id "$DR_INSTANCE_ID" \
--device /dev/sdf
aws ec2 attach-volume \
--region "$AWS_REGION" \
--volume-id "$RESTORED_DATA_VOLUME_2" \
--instance-id "$DR_INSTANCE_ID" \
--device /dev/sdgValidation Checklist
- Recovered instance boots cleanly from AMI.
- Expected filesystems and data volumes are mounted.
- Application health endpoints and login paths pass.
- DNS or load balancer cutover is completed.