AWS S3 Backup System: Complete Setup Guide with Cross-Region Replication
Introduction
Building a resilient backup system is crucial for protecting your data against regional failures, accidental deletions, and disasters. This comprehensive guide walks you through setting up a production-ready S3 backup system with cross-region replication, lifecycle policies, and automated cost optimization.
What You’ll Learn
- How to create a primary S3 bucket with versioning and encryption
- Setting up cross-region replication (CRR) for disaster recovery
- Configuring lifecycle policies for cost optimization
- Testing and verifying your backup system
- Complete cleanup procedures to avoid ongoing charges
- Operational best practices and troubleshooting
Prerequisites
- AWS Console access with permissions to manage S3 and create IAM roles
- Basic understanding of S3 concepts (buckets, versioning, encryption)
- Decision on regions for primary and disaster recovery
- Globally unique bucket naming strategy
Architecture Overview
Our backup system architecture provides multiple layers of protection:
User/Server
↓ (upload)
PRIMARY Bucket (Primary Region)
- Versioning: Enabled
- Encryption: SSE-S3
- Lifecycle: 30d → IA, 90d → Glacier, delete noncurrent after 60d
↓ (Cross-Region Replication)
SECONDARY Bucket (DR Region)
- Versioning: Enabled
- Encryption: SSE-S3
- Role: Auto-created IAM role
Key Benefits
- Disaster Recovery: Cross-region replication protects against regional outages
- Version Protection: Object versioning prevents accidental data loss
- Cost Optimization: Lifecycle policies automatically move data to cheaper storage classes
- Security: Server-side encryption and blocked public access
- Automation: Hands-off operation once configured
Step-by-Step Setup
Phase 1: Planning and Variables
Before starting, decide on these variables and write them down:
- PRIMARY_REGION: e.g.,
ap-south-1 (Asia Pacific - Mumbai) - DR_REGION: e.g.,
eu-west-1 (Europe - Ireland) - must differ from PRIMARY_REGION - BUCKET_PREFIX: e.g.,
my-company-backups (must be globally unique) - PRIMARY_BUCKET_NAME:
{BUCKET_PREFIX}-primary-{PRIMARY_REGION} - SECONDARY_BUCKET_NAME:
{BUCKET_PREFIX}-secondary-{DR_REGION}
Example Configuration:
- PRIMARY_REGION:
us-east-1 - DR_REGION:
eu-west-1 - BUCKET_PREFIX:
mycompany-backups - PRIMARY_BUCKET_NAME:
mycompany-backups-primary-us-east-1 - SECONDARY_BUCKET_NAME:
mycompany-backups-secondary-eu-west-1
Phase 2: Create Primary Bucket
2.1 Navigate to S3 Console
- Go to AWS S3 Console
- Click “Create bucket”
Essential Configuration:
- Bucket name:
PRIMARY_BUCKET_NAME (e.g., mycompany-backups-primary-us-east-1) - AWS Region:
PRIMARY_REGION (e.g., us-east-1) - Object Ownership: Keep default (Bucket owner enforced)
- Block Public Access: Leave all four options checked
- Bucket Versioning: Enable (critical for replication)
- Default encryption: Enable, choose Server-side encryption with Amazon S3 managed keys (SSE-S3)
- Advanced settings: Leave defaults
2.3 Validation Checks
After creation, verify:
- Bucket appears in list with the intended region
- Opening the bucket → Properties shows:
- Versioning: Enabled
- Default encryption: SSE-S3
- Block public access: All settings enabled
Phase 3: Create Secondary Bucket (DR Region)
3.1 Create Disaster Recovery Bucket
- S3 → “Create bucket”
- Bucket name:
SECONDARY_BUCKET_NAME (e.g., mycompany-backups-secondary-eu-west-1) - AWS Region:
DR_REGION (e.g., eu-west-1) - Object Ownership: Bucket owner enforced
- Block Public Access: Keep all checked
- Bucket Versioning: Enable (required for replication)
- Default encryption: SSE-S3
- Click “Create bucket”
3.2 Validation Checks
- Bucket exists in DR region
- Versioning and encryption enabled
- Public access blocked
4.1 Set Up Replication Rule
In your PRIMARY_BUCKET_NAME:
- Open bucket → “Management” tab → “Replication rules” → “Create replication rule”
- Rule name:
Replicate-to-DR-region - Status: Enabled
- Choose rule scope: Apply to all objects in the bucket
- Destination:
- Destination bucket: This account
- Select
SECONDARY_BUCKET_NAME (ensure region shows DR_REGION)
- IAM role: Select “Create new role” (allow S3 to create the role/policy)
- Encryption: Keep defaults (SSE-S3 on both buckets is already enabled)
- Delete marker replication: Leave default unless your retention policy requires otherwise
- Review → Save rule
4.2 Important Notes
- Replication only applies to new objects/versions after the rule is enabled
- Existing objects require S3 Batch Replication (optional and billable)
- The auto-created IAM role will have necessary permissions for replication
4.3 Validation Checks
- Rule appears Enabled in the Replication rules table
- Replication status on future object uploads shows as pending/completed over time
Phase 5: Add Lifecycle Rules for Cost Optimization
In PRIMARY_BUCKET_NAME:
- Management tab → Lifecycle rules → Create lifecycle rule
- Rule name:
Archive-and-cleanup-policy - Choose: Apply to all objects in the bucket
- Configure actions:
- Transition current versions between storage classes:
- Add transition → S3 Standard-IA after 30 days
- Add transition → S3 Glacier Flexible Retrieval after 90 days
- Permanently delete noncurrent versions:
- Delete noncurrent versions after 60 days
- Expired object delete markers and incomplete multipart uploads:
- Delete incomplete multipart uploads after 7 days
- Review → Create rule
5.2 Optional: Secondary Bucket Lifecycle
If you want different retention/cost behavior for replicas, create a separate lifecycle rule on the secondary bucket.
5.3 Validation Checks
- Rule appears active with the configured transitions and expirations
- Review the lifecycle policy to ensure it matches your retention requirements
Phase 6: Test the Backup System
6.1 Prepare Test Files
- Create a local file named
my-test-file.txt with content: version 1 - Save it for testing
6.2 Upload and Version Test
- In
PRIMARY_BUCKET_NAME → Objects → Upload → Add files → choose my-test-file.txt → Upload - Open the uploaded object → Confirm Versions shows one version
- Update the local file to
version 2 → Upload again with the same key name to PRIMARY_BUCKET_NAME - Open the object → Confirm multiple versions are listed
6.3 Verify Replication
- Wait a few minutes for replication (typically 2-5 minutes)
- Open
SECONDARY_BUCKET_NAME → Locate my-test-file.txt - Confirm it is present (versions may appear as they replicate)
- Check that both buckets show the same object versions
6.4 Validation Commands
# Check replication status (if AWS CLI is configured)
aws s3api head-object --bucket PRIMARY_BUCKET_NAME --key my-test-file.txt
# List object versions
aws s3api list-object-versions --bucket PRIMARY_BUCKET_NAME --prefix my-test-file.txt
Operational Procedures
Daily Backup Operations
Uploading Files
Via AWS Console:
- S3 →
PRIMARY_BUCKET_NAME → Upload - Add files → Upload
- Verify success in Objects list
Via AWS CLI:
# Single file
aws s3 cp /path/to/file.txt s3://PRIMARY_BUCKET_NAME/
# Entire directory
aws s3 sync /local/backup/path s3://PRIMARY_BUCKET_NAME/backup/
Restoring from Backup
Latest version:
- S3 → PRIMARY or SECONDARY bucket → Object → Download
Older version:
- S3 → Bucket → Object → Show versions
- Select desired version → Download
Via AWS CLI:
# Download latest version
aws s3 cp s3://PRIMARY_BUCKET_NAME/file.txt ./restored-file.txt
# Download specific version
aws s3api get-object --bucket PRIMARY_BUCKET_NAME --key file.txt --version-id VERSION_ID restored-file.txt
Monitoring and Verification
Check Replication Status
- S3 →
PRIMARY_BUCKET_NAME → Management → Replication rules → View status - Look for replication metrics and any error messages
Monitor Storage Costs
- AWS Cost Explorer → Filter by S3 service
- AWS Budgets → Set up cost alerts
- S3 Storage Lens → Analyze usage patterns
Enable Replication Metrics
- S3 →
PRIMARY_BUCKET_NAME → Management → Replication - Enable metrics and event notifications
- View in CloudWatch or S3 console
Troubleshooting
Common Issues and Solutions
Object Not Replicating
Problem: Objects uploaded to primary bucket don’t appear in secondary bucket
Solution:
- Check replication rule status: Ensure rule is Enabled
- Verify versioning: Both buckets must have versioning enabled
- Confirm destination: Check that destination bucket and region are correct
- Timing: Replication is asynchronous; wait 5-15 minutes
- Existing objects: Replication only applies to new objects after rule creation
Access Denied Errors
Problem: Replication status shows “Access Denied”
Solution:
- Check IAM role: Verify the auto-created replication role exists and is unmodified
- Recreate rule: If role was modified, delete and recreate the replication rule
- Permissions: Ensure the role has necessary S3 permissions
High Storage Costs
Problem: Unexpected storage charges
Solution:
- Check lifecycle rules: Ensure they’re active and properly configured
- Review old versions: Manually delete old noncurrent versions if needed
- Incomplete uploads: Check for and delete incomplete multipart uploads
- Set up cost alerts: Use AWS Budgets to monitor spending
Cannot Delete Bucket
Problem: “BucketNotEmpty” error when trying to delete
Solution:
- Empty bucket first: Use the “Empty” button in S3 console
- Check versions: Toggle “Show versions” to see all object versions
- Delete incomplete uploads: Remove any incomplete multipart uploads
- Wait for lifecycle: If lifecycle rules are active, wait for them to process
Debugging Commands
# Check replication status
aws s3api head-object --bucket PRIMARY_BUCKET_NAME --key filename.txt
# List all object versions
aws s3api list-object-versions --bucket PRIMARY_BUCKET_NAME
# Check bucket versioning
aws s3api get-bucket-versioning --bucket PRIMARY_BUCKET_NAME
# Verify replication configuration
aws s3api get-bucket-replication --bucket PRIMARY_BUCKET_NAME
Security Best Practices
Implemented Security Features
- Private Buckets: No public access to backup data
- Server-Side Encryption: SSE-S3 encryption for data at rest
- Versioning: Protection against accidental deletions
- Cross-Region Replication: Geographic redundancy
- IAM Roles: Least-privilege access for replication
Additional Security Recommendations
- Enable MFA Delete: For critical buckets (requires root account)
- S3 Access Logging: Enable for audit trails
- CloudTrail: Monitor S3 data events
- Bucket Policies: Restrict access to specific IP ranges if needed
- SSE-KMS: Consider customer-managed keys for stricter compliance
- Object Lock: For compliance requirements (WORM - Write Once, Read Many)
Cost Optimization
Lifecycle Policy Benefits
- S3 Standard-IA: ~50% cheaper than Standard after 30 days
- S3 Glacier Flexible Retrieval: ~90% cheaper for long-term archives
- Automatic cleanup: Delete old versions and incomplete uploads
- Cost monitoring: Set up alerts to track spending
Cost Monitoring Setup
AWS Budgets:
- Create cost budget for S3 service
- Set monthly limit (e.g., $50)
- Configure email alerts at 80%, 100%
CloudWatch Alarms:
- Monitor bucket size metrics
- Set up notifications for unusual activity
S3 Storage Lens:
- Analyze usage patterns
- Identify optimization opportunities
Cleanup Guide
If you need to remove all resources to avoid ongoing charges:
Cleanup Order (Critical - Follow This Sequence)
Phase 1: Disable Replication Rule
- S3 →
PRIMARY_BUCKET_NAME → Management → Replication rules - Select the rule
Replicate-to-DR-region - Actions → Disable rule (or Delete rule)
- Confirm
Phase 2: Delete Lifecycle Rules
- In
PRIMARY_BUCKET_NAME → Management → Lifecycle rules - Select
Archive-and-cleanup-policy - Delete → Confirm
- Repeat for secondary bucket if applicable
Phase 3: Empty Both Buckets
- S3 →
PRIMARY_BUCKET_NAME → Objects → Empty - Type
permanently delete → Confirm - Repeat for
SECONDARY_BUCKET_NAME
Phase 4: Delete Both Buckets
- S3 → Buckets → Select
PRIMARY_BUCKET_NAME → Delete - Type exact bucket name → Confirm
- Repeat for
SECONDARY_BUCKET_NAME
Phase 5: Clean Up IAM Role (Optional)
- IAM → Roles → Search for replication role
- Select role → Delete → Confirm
Verification After Cleanup
# Check if buckets still exist (should fail)
aws s3 ls s3://PRIMARY_BUCKET_NAME/
aws s3 ls s3://SECONDARY_BUCKET_NAME/
# Verify IAM role is deleted
aws iam get-role --role-name REPLICATION_ROLE_NAME
Quick Reference Commands
Essential AWS CLI Commands
# Upload file to S3
aws s3 cp file.txt s3://PRIMARY_BUCKET_NAME/
# Sync directory to S3
aws s3 sync /local/path s3://PRIMARY_BUCKET_NAME/backup/
# List all objects and versions
aws s3api list-object-versions --bucket PRIMARY_BUCKET_NAME
# Download specific version
aws s3api get-object --bucket PRIMARY_BUCKET_NAME --key file.txt --version-id VERSION_ID output.txt
# Check replication status
aws s3api head-object --bucket PRIMARY_BUCKET_NAME --key file.txt
# Delete specific version
aws s3api delete-object --bucket PRIMARY_BUCKET_NAME --key file.txt --version-id VERSION_ID
Monitoring Commands
# Check bucket versioning
aws s3api get-bucket-versioning --bucket PRIMARY_BUCKET_NAME
# Get replication configuration
aws s3api get-bucket-replication --bucket PRIMARY_BUCKET_NAME
# List lifecycle rules
aws s3api get-bucket-lifecycle-configuration --bucket PRIMARY_BUCKET_NAME
Detailed Operational Procedures
Daily Backup Operations
Uploading Files via Console
Navigate to Primary Bucket:
- S3 →
PRIMARY_BUCKET_NAME → Objects tab - Click “Upload”
Add Files:
- Click “Add files” or “Add folder”
- Select files or folders to upload
- Review selected items
Configure Upload Settings (Optional):
- Storage class: Standard (default)
- Encryption: Server-side encryption with Amazon S3 managed keys
- Access control list (ACL): Keep default settings
Upload:
- Click “Upload” at the bottom
- Wait for upload completion
- Verify files appear in Objects list
Uploading Files via AWS CLI
# Single file upload
aws s3 cp /path/to/file.txt s3://PRIMARY_BUCKET_NAME/
# Multiple files
aws s3 cp /path/to/directory/ s3://PRIMARY_BUCKET_NAME/backup/ --recursive
# Sync entire directory (recommended for backups)
aws s3 sync /local/backup/path s3://PRIMARY_BUCKET_NAME/backup/
# Upload with specific storage class
aws s3 cp file.txt s3://PRIMARY_BUCKET_NAME/ --storage-class STANDARD_IA
# Upload with metadata
aws s3 cp file.txt s3://PRIMARY_BUCKET_NAME/ --metadata "backup-date=2024-12-17,environment=production"
Restoring from Backup
Latest Version (Console):
- S3 → PRIMARY or SECONDARY bucket → Objects
- Find the file → Click “Download”
- Save to desired location
Specific Version (Console):
- S3 → Bucket → Object → “Show versions”
- Select desired version from the list
- Click “Download” for that version
Via AWS CLI:
# Download latest version
aws s3 cp s3://PRIMARY_BUCKET_NAME/file.txt ./restored-file.txt
# Download specific version
aws s3api get-object --bucket PRIMARY_BUCKET_NAME --key file.txt --version-id VERSION_ID restored-file.txt
# List all versions of a file
aws s3api list-object-versions --bucket PRIMARY_BUCKET_NAME --prefix file.txt
# Restore entire directory
aws s3 sync s3://PRIMARY_BUCKET_NAME/backup/ /local/restore/path/
Monitoring and Verification Procedures
Check Replication Status
Via Console:
- S3 →
PRIMARY_BUCKET_NAME → Management → Replication rules - Click on the replication rule
- View “Replication status” for recent objects
- Check for any error messages or warnings
Via AWS CLI:
# Check if object has been replicated
aws s3api head-object --bucket PRIMARY_BUCKET_NAME --key filename.txt
# Get replication configuration
aws s3api get-bucket-replication --bucket PRIMARY_BUCKET_NAME
# Check replication metrics (if enabled)
aws logs describe-log-groups --log-group-name-prefix "/aws/s3/replication"
Monitor Storage Costs
AWS Cost Explorer:
- Go to AWS Cost Explorer
- Filter by Service: Amazon S3
- Group by Usage Type to see storage costs
- Set date range to monitor trends
AWS Budgets Setup:
- AWS Budgets → Create budget
- Budget type: Cost budget
- Scope: S3 service only
- Amount: Set monthly limit (e.g., $50)
- Alerts: Configure at 80%, 100% of budget
- Actions: Email notifications
S3 Storage Lens:
- S3 → Storage Lens → Create dashboard
- Scope: Include your backup buckets
- Metrics: Enable cost optimization recommendations
- Schedule: Weekly or monthly reports
Enable Replication Metrics
Setup:
- S3 →
PRIMARY_BUCKET_NAME → Management → Replication - Metrics: Enable “Replication metrics”
- Event notifications: Enable “Replication events”
- CloudWatch logs: Enable for detailed monitoring
View Metrics:
- CloudWatch → Metrics → S3
- Look for “ReplicationLatency” and “ReplicationBytes”
- Set up alarms for replication failures
Advanced Operations
Batch Operations for Existing Objects
If you have existing objects that need replication:
S3 Batch Operations:
- S3 → Batch Operations → Create job
- Operation: Replicate objects
- Manifest: Create manifest file listing objects
- Destination: Secondary bucket
- IAM role: Use existing replication role
AWS CLI for Batch Replication:
# Create manifest file
aws s3api list-objects-v2 --bucket PRIMARY_BUCKET_NAME --output json > manifest.json
# Submit batch job
aws s3control create-job \
--account-id YOUR_ACCOUNT_ID \
--operation '{"S3ReplicateObject": {"TargetResource": "arn:aws:s3:::SECONDARY_BUCKET_NAME"}}' \
--manifest '{"Spec": {"Format": "S3BatchOperations_CSV_20180820", "Fields": ["Bucket", "Key"]}, "Location": {"ObjectArn": "arn:aws:s3:::PRIMARY_BUCKET_NAME/manifest.csv"}}' \
--priority 10 \
--role-arn arn:aws:iam::YOUR_ACCOUNT_ID:role/S3ReplicationRole
Cross-Account Replication Setup
If you need to replicate to a different AWS account:
- Create IAM Role in Destination Account:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::SOURCE_ACCOUNT_ID:root"
},
"Action": "s3:ReplicateObject",
"Resource": "arn:aws:s3:::DESTINATION_BUCKET_NAME/*"
}
]
}
- Update Source Bucket Policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:ReplicateObject",
"Resource": "arn:aws:s3:::DESTINATION_BUCKET_NAME/*"
}
]
}
Disaster Recovery Procedures
Primary Region Outage:
Switch to Secondary Region:
- Update applications to use secondary bucket
- Monitor primary region status
- Continue operations from secondary region
Failback Process:
- Once primary region is restored
- Create reverse replication rule (secondary → primary)
- Sync any changes made during outage
- Switch back to primary region
Data Corruption Recovery:
Identify Corrupted Objects:
- Check object versions in primary bucket
- Compare with secondary bucket versions
- Identify the last known good version
Restore from Secondary:
# Download good version from secondary
aws s3 cp s3://SECONDARY_BUCKET_NAME/corrupted-file.txt ./good-version.txt
# Upload to primary bucket (creates new version)
aws s3 cp ./good-version.txt s3://PRIMARY_BUCKET_NAME/corrupted-file.txt
Common Error Messages and Solutions
| Error Message | Cause | Solution |
|---|
BucketNotEmpty | Trying to delete bucket with objects | Empty bucket first using “Empty” button |
AccessDenied | Insufficient permissions | Check IAM policies and bucket policies |
InvalidBucketState | Versioning disabled | Enable versioning on both buckets |
NoSuchVersion | Version ID doesn’t exist | Verify version ID, check if deleted |
ReplicationConfigurationNotFoundError | No replication rule | Create replication rule |
InvalidRequest | Bucket policy conflicts | Review and update bucket policies |
NoSuchBucket | Bucket doesn’t exist | Verify bucket name and region |
Upload Optimization
Multipart Upload for Large Files:
# AWS CLI automatically uses multipart for files > 64MB
aws s3 cp large-file.zip s3://PRIMARY_BUCKET_NAME/
# Configure multipart threshold
aws configure set default.s3.multipart_threshold 64MB
aws configure set default.s3.multipart_chunksize 16MB
Parallel Uploads:
# Use --cli-read-timeout and --cli-connect-timeout for better performance
aws s3 sync /local/path s3://PRIMARY_BUCKET_NAME/ --cli-read-timeout 0 --cli-connect-timeout 60
Download Optimization
Parallel Downloads:
# Use s3 sync for efficient downloads
aws s3 sync s3://PRIMARY_BUCKET_NAME/backup/ /local/restore/path/
# Configure transfer acceleration (if enabled)
aws s3 cp s3://PRIMARY_BUCKET_NAME/file.txt ./file.txt --endpoint-url https://s3-accelerate.amazonaws.com
Security Hardening
Enable MFA Delete
Setup (requires root account):
# Enable MFA delete (requires root account credentials)
aws s3api put-bucket-versioning \
--bucket PRIMARY_BUCKET_NAME \
--versioning-configuration Status=Enabled,MFADelete=Enabled \
--mfa "arn:aws:iam::ACCOUNT_ID:mfa/root-account-mfa-device MFA_CODE"
Enable S3 Access Logging
Setup:
- Create logging bucket:
mycompany-backups-logs - Configure access logging:
{
"LoggingEnabled": {
"TargetBucket": "mycompany-backups-logs",
"TargetPrefix": "access-logs/"
}
}
CloudTrail Integration
Enable S3 Data Events:
- CloudTrail → Trails → Create trail
- Data events: Enable S3 data events
- S3 bucket: Select your backup buckets
- Event types: All events (Read, Write)
Cost Monitoring and Optimization
Detailed Cost Analysis
S3 Storage Lens Dashboard:
- S3 → Storage Lens → Create dashboard
- Scope: Include backup buckets
- Metrics: Enable all cost optimization metrics
- Schedule: Weekly reports
Cost Allocation Tags:
# Tag buckets for cost allocation
aws s3api put-bucket-tagging \
--bucket PRIMARY_BUCKET_NAME \
--tagging 'TagSet=[{Key=Environment,Value=Production},{Key=Project,Value=Backup}]'
Lifecycle Policy Optimization
Review Current Lifecycle:
# Get current lifecycle configuration
aws s3api get-bucket-lifecycle-configuration --bucket PRIMARY_BUCKET_NAME
# Analyze storage class distribution
aws s3api list-objects-v2 --bucket PRIMARY_BUCKET_NAME --query 'Contents[].StorageClass' --output table
Optimize Lifecycle Rules:
- Frequent Access: 0-30 days (Standard)
- Infrequent Access: 30-90 days (Standard-IA)
- Archive: 90-365 days (Glacier Flexible Retrieval)
- Deep Archive: 365+ days (Glacier Deep Archive)
Maintenance Procedures
Weekly Maintenance
Verify Replication:
- Upload test file to primary bucket
- Check secondary bucket within 15 minutes
- Verify object versions match
Check Storage Costs:
- Review AWS Cost Explorer
- Check for unexpected spikes
- Verify lifecycle rules are working
Monitor Alerts:
- Check CloudWatch alarms
- Review S3 access logs for anomalies
- Verify backup completion notifications
Monthly Maintenance
Cost Review:
- Analyze S3 Storage Lens reports
- Review lifecycle policy effectiveness
- Optimize storage class transitions
Security Audit:
- Review access logs
- Check IAM permissions
- Verify encryption status
Performance Review:
- Analyze replication latency
- Check for failed replications
- Review transfer acceleration usage
Quarterly Maintenance
Disaster Recovery Test:
- Simulate primary region outage
- Test failover procedures
- Verify data integrity in secondary region
Compliance Review:
- Review retention policies
- Check audit logs
- Verify encryption compliance
Capacity Planning:
- Analyze growth trends
- Plan for storage increases
- Review cost projections
Emergency Procedures
Data Loss Recovery
Accidental Deletion:
Check Object Versions:
- S3 → Bucket → Object → Show versions
- Look for delete markers
- Delete the delete marker to restore object
Restore from Secondary:
- Download from secondary bucket
- Upload to primary bucket
- Verify data integrity
Corrupted Data:
- Compare Versions:
- Check object versions in both buckets
- Identify last known good version
- Restore from secondary if needed
Regional Outage Response
Primary Region Down:
Immediate Actions:
- Switch applications to secondary region
- Monitor primary region status
- Document any changes made
During Outage:
- Continue operations from secondary
- Monitor costs (cross-region transfer charges)
- Keep stakeholders informed
Recovery Process:
- Wait for primary region restoration
- Create reverse replication rule
- Sync changes back to primary
- Switch applications back to primary
Scaling Considerations
Multiple Applications
Bucket Organization:
mycompany-backups-primary-us-east-1/
├── app1/
│ ├── database/
│ └── files/
├── app2/
│ ├── logs/
│ └── configs/
└── shared/
└── common/
Separate Lifecycle Policies:
- Database backups: 7 days Standard → 30 days IA → 90 days Glacier
- Log files: 1 day Standard → 7 days IA → 30 days Glacier
- Config files: 30 days Standard → 90 days IA → 365 days Glacier
Global Presence
Multiple DR Regions:
- Primary:
us-east-1 - DR Region 1:
eu-west-1 - DR Region 2:
ap-southeast-1
Replication Rules:
- Primary → DR Region 1 (immediate)
- Primary → DR Region 2 (delayed)
- DR Region 1 → DR Region 2 (backup)
Compliance Requirements
Object Lock for WORM:
# Enable object lock on bucket
aws s3api put-object-lock-configuration \
--bucket PRIMARY_BUCKET_NAME \
--object-lock-configuration '{
"ObjectLockEnabled": "Enabled",
"Rule": {
"DefaultRetention": {
"Mode": "COMPLIANCE",
"Days": 2555
}
}
}'
MFA Delete for Critical Data:
# Enable MFA delete (requires root account)
aws s3api put-bucket-versioning \
--bucket PRIMARY_BUCKET_NAME \
--versioning-configuration Status=Enabled,MFADelete=Enabled \
--mfa "arn:aws:iam::ACCOUNT_ID:mfa/root-account-mfa-device MFA_CODE"
Best Practices Summary
Regular Maintenance Tasks
- Weekly: Verify replication is working (spot-check objects)
- Monthly: Review storage costs and lifecycle effectiveness
- Quarterly: Test disaster recovery by restoring from secondary bucket
- Annually: Review and update retention policies
When to Scale
- Multiple applications: Create separate buckets with prefixes or folders
- Compliance requirements: Add bucket policies, MFA Delete, object lock
- Performance needs: Use S3 Transfer Acceleration or multipart uploads
- Global presence: Add more DR regions
Emergency Procedures
- Data Loss: Check object versions and restore from secondary bucket
- Regional Outage: Switch to secondary region for operations
- Cost Overrun: Review lifecycle policies and delete old versions
- Access Issues: Check IAM permissions and bucket policies
Conclusion
This S3 backup system provides enterprise-grade data protection with:
- Disaster Recovery: Cross-region replication protects against regional failures
- Version Protection: Object versioning prevents accidental data loss
- Cost Optimization: Automated lifecycle policies reduce storage costs
- Security: Encryption and access controls protect your data
- Automation: Hands-off operation once configured
Key Benefits
- Resilience: Multiple layers of data protection
- Cost-Effective: Automated cost optimization with lifecycle policies
- Scalable: Easy to expand for multiple applications
- Compliant: Meets most regulatory requirements
- Operational: Simple daily operations and monitoring
Next Steps
- Monitor your backup system regularly
- Test disaster recovery procedures quarterly
- Review costs monthly and adjust lifecycle policies as needed
- Scale the system as your backup requirements grow
- Implement additional security measures based on compliance needs
For questions or issues, refer to the troubleshooting section or AWS documentation. This setup provides a solid foundation for protecting your critical data with enterprise-grade reliability and cost optimization.