Skip to main content

Scenario: AWS S3 Multi-Region DR

Diagram convention: Arrows and messages are labeled 1, 2, 3… to show processing order. Each diagram is followed by a Step-by-step flow table explaining every numbered step.

1. The Interview Question​

"Your platform stores critical documents in S3. Define RPO/RTO for regional failure and design failover."

2. Real-World Context​

DimensionDetail
Company / systemAmazon S3 — 11 nines durability within a region; cross-region replication (CRR) for regional DR
ScaleExabyte-scale object storage; millions of objects; compliance archives with multi-year retention
Why architects careDurability ≠ availability — S3 survives AZ loss but not regional outage without explicit DR design
Public referencesAWS S3 CRR docs; AWS Builder's Library on resilience

AWS deployment context​

Typical document platform with S3 DR on AWS: S3 primary bucket in us-east-1 with versioning; S3 Cross-Region Replication to us-west-2 standby bucket; optional S3 Replication Time Control (RTC) for bounded RPO; ECS Fargate document API; RDS Aurora with cross-region read replica; Route 53 failover routing; CloudFront with origin failover for static assets; AWS Systems Manager Parameter Store for active-region flag; CloudWatch for ReplicationLatency and failover alarms; AWS Backup for point-in-time recovery.

Step-by-step flow:

StepActionExplanation
1Resolve DNSRoute 53 returns primary region ALB when health check passes.
2Route to primaryTraffic flows to us-east-1 under normal operation.
3PutObject / GetObjectDocument API reads/writes objects in primary S3 bucket.
4Metadata writeObject keys, ACLs, and search index stored in Aurora — separate DR concern.
5CRR asyncS3 replicates new/updated objects to standby bucket — RPO floor = replication lag.
6Async replicationAurora cross-region replica trails primary — promote on failover.
7Origin failoverCloudFront can switch S3 origin to replica bucket on health failure.
8On failureDR path activated when primary region impaired.

3. Step-by-Step Interview Answer​

Step 1 — Define RPO/RTO with business​

TierRPORTOExample workloadDR pattern
Critical15 min1 hourCustomer contracts, legal docsCRR + RTC; warm standby ECS
Standard24 hours4 hoursAnalytics exports, reportsCRR without RTC; pilot light
Archive7 days24 hoursCompliance cold storageS3 Batch Replication + Glacier

Key distinction:

ConceptS3 within regionCross-region
Durability99.999999999% (11 nines)Depends on CRR + RTC
Availability99.99% SLA per regionNot automatic — requires failover design
AZ failureTolerated nativelyN/A
Regional failureNot auto-recoveredRequires CRR + runbook

Step 2 — Capacity and cost math​

MetricCalculationResult
Storage50 TB primary + CRR100 TB total (2× storage cost)
CRR transfer500 GB new objects/day~$10/day cross-region egress
RTC premium99.99% of objects within 15 minAdditional per-GB fee
Replication lagTypical without RTC1–15 min; measure ReplicationLatency
Failover RTODNS TTL (60s) + RDS promote (15 min) + ECS scale (10 min)~30 min realistic

Step 3 — DR architecture options​

Step-by-step flow:

StepPatternWhen to use
1Backup & RestoreNon-critical; lowest cost; RPO = backup interval
2Pilot LightCRR replicates data; DR region has infra stubs only
3Warm StandbyCRR + scaled-down ECS/RDS replica; faster RTO
4Active-PassiveCRR + RTC + hot standby; critical tier with 15-min RPO

Step 4 — S3 CRR configuration​

Step-by-step flow:

StepActionExplanation
1IAM replication roleS3 assumes role with s3:ReplicateObject, s3:ReplicateDelete permissions.
2CRR ruleConfigure destination bucket, prefix filters, storage class.
3RTC optionalReplication Time Control: 99.99% of objects replicated within 15 minutes.
4Versioning ONRequired on both source and destination buckets.
5KMS per regionRe-encrypt with destination-region KMS key on replicate.
6Delete markersOptionally replicate delete markers for consistency.

Step 5 — Regional failover sequence​

Step-by-step flow:

StepActionExplanation
1Health check failsRoute 53 or CloudWatch alarm detects primary region impairment.
2Failover DNSRoute 53 failover policy routes to DR ALB (TTL propagation ~60s).
3Promote RDS replicaAurora cross-region replica promoted to writer — accept RPO gap.
4Scale DR ECSWarm standby tasks scaled to production capacity.
5Update active_regionSSM Parameter Store flag flips app config to us-west-2.
6Redirect S3 readsApplication reads from replica bucket prefix or MRAP endpoint.
7Validate RPOCheck ReplicationLatency metric — quantify data loss window.
8Announce completeStatus page update; begin failback planning.

Step 6 — Metadata DB DR (common miss)​

Step-by-step flow:

StepLayerExplanation
1S3 CRRObjects replicate asynchronously — RPO = lag.
2Aurora CRRMetadata (object keys, ACLs, search index) has separate replication lag.
3Combined RPOWorst of both — object may exist in S3 but metadata missing, or vice versa.
4FailoverMust promote both data planes: S3 read path + RDS writer.
5Consistency checkPost-failover: reconcile orphaned objects vs metadata gaps.

4. Whiteboard Guide​

Draw three layers top-to-bottom: Routing → Compute + Metadata → S3 Storage. Emphasize S3 does not auto-failover — the application or routing layer must redirect.

Step-by-step flow:

StepComponentRole
1Route 53Failover routing with health checks on primary ALB.
2SSM Parameter Storeactive_region flag consumed by application at startup.
3S3 CRR + RTCAsync replication; RTC bounds RPO to 15 min for 99.99% of objects.
4Aurora CRRMetadata replication; promote on failover.
5CloudWatchReplicationLatency, BytesPendingReplication alarms.
6SNSPage on-call when replication lag exceeds RPO threshold.

5. Principal-Level Signals​

SignalWhat strong candidates say
Durability ≠ availability"11 nines durability within a region does not protect against regional outage."
RPO from replication lag"Our RPO floor is measured ReplicationLatency, not a wish — typically 1–15 min without RTC."
Metadata DB included"S3 CRR alone is insufficient — object keys live in RDS; both must fail over."
No auto-failover"S3 has no built-in regional failover — Route 53 or app config must redirect."
Failback plan"Returning to primary requires preventing split-brain writes to both buckets."
Tested runbook"Untested DR is fiction — quarterly game days with timed RTO."

6. Red Flags​

Red flagWhy it fails
"S3 is durable, we're fine"Durability ≠ regional availability; regional outage loses read/write access.
S3 CRR without versioningCRR requires versioning enabled on source and destination.
Ignoring metadata DBObjects replicate but app can't find them without metadata failover.
Assuming zero RPOCRR is async; RPO > 0 unless RTC + measurement proves otherwise.
No failback planSplit-brain writes to both buckets corrupt data on return to primary.
Never tested failoverRTO in runbook ≠ RTO in production without game days.
CRR for existing objects only via rulePre-existing objects need S3 Batch Replication — CRR is forward-only by default.

7. Follow-Up Questions​

QuestionStrong answer
S3 Multi-Region Access Points (MRAP)?Single global endpoint; automatic routing to nearest bucket; simplifies client failover but adds cost.
How to replicate existing objects?S3 Batch Replication job — CRR rules only apply to new changes after rule creation.
Delete marker replication?Configure in replication rule; otherwise deletes in primary don't propagate.
Encryption across regions?Use destination-region KMS key; replication role needs kms:Decrypt + kms:GenerateDataKey.
How to prevent split-brain on failback?Read-only primary until CRR backfill complete; single-writer enforcement via SSM flag.
S3 vs Glacier for DR?Glacier for archive tier; CRR to Glacier Deep Archive for compliance; higher RTO on restore.
What about S3 Object Lock?WORM compliance; replication of locked objects requires matching retention on destination.

8. Practice Drill (10 min)​

  1. 2 min — State RPO/RTO for critical vs standard tier with business justification.
  2. 3 min — Draw CRR flow: primary bucket → replication role → replica bucket.
  3. 3 min — Draw failover sequence: health fail → DNS → RDS promote → S3 redirect.
  4. 2 min — Name the metadata DB gap — why S3 CRR alone is insufficient.

9. Key Takeaways​

  1. Durability ≠ availability — S3's 11 nines protect against object loss, not regional outage.
  2. CRR is async — RPO floor = replication lag; use RTC for bounded 15-min RPO.
  3. Metadata is a separate DR story — RDS/Aurora promotion must accompany S3 failover.
  4. No built-in S3 failover — Route 53, CloudFront origin failover, or app config redirect required.
  5. Test quarterly — Game days with timed RTO; chaos-block primary endpoints in staging.

10. Production HLD​

10.1 C4 Context​

Step-by-step flow:

StepInteractionExplanation
1User ↔ PlatformUpload, download, search documents.
2S3 PrimarySource of truth for object bytes in active region.
3S3 DRCRR replica; becomes read/write target on failover.
4AuroraMetadata: object keys, ACLs, search index.
5Aurora DRCross-region replica; promoted on failover.
6OperationsExecutes tested runbook on regional impairment.

10.2 Full production stack​

LayerAWS ServicePurpose
Object storageS3 (versioned)Primary + replica buckets with CRR
Bounded RPOS3 Replication Time Control99.99% objects within 15 min
Existing object backfillS3 Batch ReplicationReplicate pre-rule objects
MetadataAurora PostgreSQLObject index, ACLs, audit log
Metadata DRAurora Global Database / CRRCross-region read replica
ComputeECS FargateDocument API (warm standby in DR)
RoutingRoute 53 failoverDNS-based regional failover
CDNCloudFront origin failoverStatic asset resilience
ConfigSSM Parameter Storeactive_region, bucket names
EncryptionKMS (per region)SSE-KMS with cross-region grant
ObservabilityCloudWatch + SNSReplication lag, failover alarms
ComplianceS3 Object Lock + AWS BackupWORM + point-in-time recovery

10.3 Architecture index​

#DiagramSection
1AWS deployment context§2
2DR pattern options§3 Step 3
3S3 CRR configuration§3 Step 4
4Regional failover sequence§3 Step 5
5Metadata DB DR gap§3 Step 6
6Whiteboard AWS layout§4
7C4 context§10.1
8Replication IAM policy§11.2
9Failover runbook flow§11.4
10HA / multi-region§12

11. Production LLD​

11.1 S3 bucket configuration​

Primary bucket (documents-prod-us-east-1)

SettingValueWhy
VersioningEnabledRequired for CRR
EncryptionSSE-KMS (alias/s3-east)Compliance; per-region key
Object LockGovernance mode (optional)WORM for legal holds
LifecycleTransition to IA after 90 daysCost optimization on standby
ReplicationCRR → documents-prod-us-west-2Regional DR
RTCEnabled (critical tier)Bounded 15-min RPO

Replica bucket (documents-prod-us-west-2)

SettingValueWhy
VersioningEnabledRequired for CRR destination
EncryptionSSE-KMS (alias/s3-west)Re-encrypt on replicate
AccessBlock all publicStandby — no direct client access until failover

11.2 IAM replication role policy​

{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetReplicationConfiguration",
"s3:ListBucket"
],
"Resource": "arn:aws:s3:::documents-prod-us-east-1"
},
{
"Effect": "Allow",
"Action": [
"s3:GetObjectVersionForReplication",
"s3:GetObjectVersionAcl",
"s3:GetObjectVersionTagging"
],
"Resource": "arn:aws:s3:::documents-prod-us-east-1/*"
},
{
"Effect": "Allow",
"Action": [
"s3:ReplicateObject",
"s3:ReplicateDelete",
"s3:ReplicateTags",
"s3:ObjectOwnerOverrideToBucketOwner"
],
"Resource": "arn:aws:s3:::documents-prod-us-west-2/*"
},
{
"Effect": "Allow",
"Action": ["kms:Decrypt"],
"Resource": "arn:aws:kms:us-east-1:ACCOUNT:key/EAST-KEY-ID"
},
{
"Effect": "Allow",
"Action": ["kms:Encrypt", "kms:GenerateDataKey"],
"Resource": "arn:aws:kms:us-west-2:ACCOUNT:key/WEST-KEY-ID"
}
]
}

11.3 Application configuration​

SSM Parameter Store

ParameterExamplePurpose
/doc-platform/active_regionus-east-1Current write region
/doc-platform/primary_bucketdocuments-prod-us-east-1Active S3 bucket
/doc-platform/replica_bucketdocuments-prod-us-west-2DR S3 bucket
/doc-platform/failover_modenormal / dr_activePrevents split-brain

Document API — region-aware S3 client

import boto3

def get_active_bucket() -> str:
ssm = boto3.client("ssm")
region = ssm.get_parameter(Name="/doc-platform/active_region")["Parameter"]["Value"]
if region == "us-east-1":
return ssm.get_parameter(Name="/doc-platform/primary_bucket")["Parameter"]["Value"]
return ssm.get_parameter(Name="/doc-platform/replica_bucket")["Parameter"]["Value"]

def put_document(key: str, body: bytes, metadata: dict) -> str:
bucket = get_active_bucket()
s3 = boto3.client("s3", region_name=active_region())
s3.put_object(Bucket=bucket, Key=key, Body=body, Metadata=metadata)
db.insert_object_metadata(key, bucket, metadata) # Aurora — same region
return key

def get_document(key: str) -> bytes:
bucket = get_active_bucket()
s3 = boto3.client("s3", region_name=active_region())
return s3.get_object(Bucket=bucket, Key=key)["Body"].read()

11.4 Failover runbook flow​

Step-by-step flow:

StepActionTarget RTO contribution
1–3Detect + declare0–5 min
4Set failover_modePrevents split-brain writes
5Promote Aurora10–15 min
6Route 53 failover1–5 min (DNS TTL)
7Scale ECS5–10 min
8Update active_regionApp reads from replica bucket
9–12Validate + communicate5–10 min
Total~30–45 min realistic RTO

11.5 CloudWatch alarms​

AlarmMetricThresholdAction
s3-replication-lag-criticalReplicationLatency> 900s (15 min)SNS page
s3-pending-replicationBytesPendingReplication> 10 GB for 10 minSNS warn
primary-alb-unhealthyRoute 53 health check3 consecutive failuresAuto-failover (optional)
aurora-replica-lagAuroraReplicaLag> 300sSNS warn

12. HA, DR, and Multi-Region​

ConcernStrategy
AZ failure (within region)S3 multi-AZ; Aurora Multi-AZ; ALB cross-AZ — no failover needed
Regional failureRoute 53 failover + Aurora promote + S3 replica redirect
Replication lagRTC for critical tier; alarm on ReplicationLatency
Split-brain preventionfailover_mode SSM flag; read-only primary until failback
FailbackReverse CRR or S3 Batch Replication; promote Aurora back; flip DNS
RansomwareS3 Object Lock + AWS Backup vault lock; immutable copies

13. Observability​

MetricTargetAlarm
ReplicationLatency (S3)< 15 min (RTC)> 900s
BytesPendingReplicationNear zero> 1 GB sustained
AuroraReplicaLag< 60s> 300s
failover.drill.success_rate100% quarterlyAny failure
document.api.p99< 500ms> 1s during failover

Dashboards: S3 replication health per bucket; Aurora lag; active region indicator; failover drill timeline.

14. Evolution Roadmap​

PhaseCapabilityTrigger
V1S3 versioning + daily AWS BackupInitial compliance requirement
V2CRR to DR regionRegional DR mandate
V3RTC + warm standby ECSCritical tier RPO < 15 min
V4S3 Multi-Region Access PointsSimplify client failover
V5Active-active with conflict resolutionGlobal write requirement

15. Testing Strategy​

Test typeScenarioPass criteria
ReplicationUpload object in primaryObject appears in replica within RTC window
Failover drillQuarterly game dayRTO < 1 hour; RPO within tier
ChaosBlock us-east-1 endpoints in stagingApp serves from us-west-2
Metadata gapObject in S3 but missing in RDSReconciliation job detects and repairs
FailbackReturn to primary after DRNo split-brain; data consistent
Batch backfillPre-existing objectsS3 Batch Replication completes

16. Production Checklist​

  • Versioning enabled on primary and replica buckets
  • CRR rule with IAM replication role configured
  • RTC enabled for critical-tier buckets
  • KMS keys in both regions with cross-region grants
  • Aurora cross-region replica in DR region
  • Route 53 failover health checks on primary ALB
  • SSM active_region and failover_mode parameters
  • Application reads active bucket from SSM (not hardcoded)
  • CloudWatch alarms on ReplicationLatency and AuroraReplicaLag
  • Quarterly failover game day with documented RTO
  • Failback runbook with split-brain prevention
  • S3 Batch Replication for pre-existing objects