Ravindra BagaleCourses & study guides English Track your progress

Multi-Region Serverless Architecture Patterns सोप्या भाषेत

Multi-region = Route 53/health, data replicate, idempotent writes, rehearsed failover — SAM दोनदा copy नव्हे.

या chapter मध्ये तुम्ही काय शिकाल

  • AA vs AP
  • Data patterns
  • DNS health
  • RPO/RTO
  • Split-brain

1. रोजचे: festival + scare

Rohan (INR) Mumbai + SEA. Lambda copy easy; stock without double-sell hard.

DNS: Route 53; data: DynamoDB / DynamoDB Global Tables; compute: Lambda per region.

2. का multi-region?

हे का लागतं?

Single-region OK until compliance/latency/event. Data story नसेल तर corruption. RPO/RTO first.

हे काय आहे?

Active-passive = standby. Active-active = both + conflicts. Global Tables = DDB replicate. Lambda per region.

3. Vertical diagram

Users -> DNS -> regional stack -> data -> runbookIdempotency cross-region
Rehearse failover
Region AAPI+Lambda+DDB Region BAPI+Lambda+DDB Route 53 / Global Accelerator / latency DNS Data: Global Tables / async replicate Failover runbook + health checks RPO/RTO explicit with product Active-active is a product decision
Multi-region is more than two stacks.

4. How: patterns

कसं करायचं (step by step)

PatternWhenHard
APDRHealth+lag
AA readRead-heavyCache
AA writeRareConflicts
PilotCheap DRBring-up

5. Commands

Route53 zones

aws route53 list-hosted-zones --query 'HostedZones[].{N:Name,Id:Id}' --output table

अर्थ: Failover records कुठे.

DDB describe

aws dynamodb describe-table --region ap-south-1 --table-name Orders \
  --query 'Table.{S:TableStatus,R:Replicas,Stream:StreamSpecification}' 

अर्थ: Replicas check.

Health checks

aws route53 list-health-checks --query 'HealthChecks[].{Id:Id,Type:HealthCheckConfig.Type}' --output table

अर्थ: Empty = no DNS failover.

Lambda other region

aws lambda get-function --function-name checkout-api --region ap-southeast-1 2>&1 | head -5

अर्थ: Twin deploy confirm.

6. Data + idempotency

  • Append-only ids.
  • LWW design.
  • No sticky.
  • Secrets per region.
  • Warm per region.

7. Industries

  • Fintech AP.
  • Ecommerce stock.
  • Media read.
  • SaaS pin.
  • Travel latency.

8. Lab

9. Lab - paper DR

Org block नसेल तर ap-south-1 (Mumbai). आधी budget alert.

कसं करायचं (step by step)

  1. RPO/RTO sentence.
  2. Replicate vs rebuild.
  3. DNS sketch.
  4. Idempotency key.

Cleanup (billing थांबवा)

  1. No prod DNS flip.
  2. Delete lab HC.

10. एकाच pattern — वेगवेगळ्या industries

  • Fintech (Aisha, Lagos): payment webhooks → SQS → Lambda.
  • Ecommerce (Rohan, Pune): checkout API; inventory SNS fan-out.
  • Healthcare (Mei, Singapore): SNS SMS; PHI + fine-grained IAM.
  • EdTech (Diego, São Paulo): EventBridge nightly cleanup.
  • Logistics (Fatima, Casablanca): EventBridge + saga.
  • Media (Kenji, Osaka): S3 → Lambda thumbs + fan-out.
  • SaaS (Priya, Bengaluru): Cognito + per-tenant partition.
  • Gov (Omar, Amman): strangler fig per form route.

11. Troubleshooting checklist

  1. Region confirm करा.
  2. CloudWatch Logs + request id.
  3. Execution role permissions.
  4. DLQ + oldest message age.
  5. curl -v + CORS.
  6. SFN event history.
  7. Linked chapter पुन्हा वाचा.
  8. Cost: concurrency/retries.

12. सामान्य errors आणि fixes

प्रत्येक row = खरी चूक. Panic करण्याआधी fix वाचा.

Error / लक्षणFix
No data planReplicate/restore.
Double-sellSingle writer.
Bad HCUser-facing HC.
No runbookRehearse.
Secret primaryPer region.
Ignore lagTolerate lag.
Role ARNRegional roles.
No game dayQuarterly.
Fantasy RTOMeasure.

13. FAQ

प्र. Required?

If demanded.

प्र. GT vs custom?

Managed vs control.

प्र. Aurora Global?

App still fails over.

प्र. Pilot vs warm?

Cost vs RTO.

प्र. R53 link?

R53 chapter.

14. Interview Q&A (Beginner / Mid / Senior + MNC)

प्र. Beginner AP

One serves.

प्र. RPO/RTO

Loss / time.

प्र. Mid idem

Duplicate writes.

प्र. HC design

User endpoint.

प्र. Senior conflict

LWW/CRDT/SW.

प्र. MNC

Game days.

15. Tips — English, मराठी आणि हिंदी

Ravindra Bagale's Tip (EN)

Agree RPO/RTO, pick data truth, automate DNS carefully, rehearse — then claim multi-region.

Ravindra Bagale's Tip (MR)

RPO/RTO, data truth, DNS, rehearse — मग multi-region claim.

Tip (HI)

RPO/RTO, data truth, DNS, rehearse — फिर multi-region claim।

घरी करून बघा

  1. RPO/RTO.
  2. List HC.

थोडक्यात सांगायचं तर

  1. गोष्टी पासून सुरू, मग services.
  2. Existing chapters link — labs copy नको.
  3. Failure साठी design.
  4. Measure → मग पैसे.

16. Architecture decision checklist

  1. User journey 5 bullets, no AWS names.
  2. Sync vs async mark.
  3. Failure mode.
  4. Idempotency key.
  5. Data from access patterns.
  6. Cost 1x and 10x.
  7. Quotas ap-south-1.
  8. Auth decision.
  9. On-call + alarm.
  10. Deep chapter link.
  11. मग console/IaC.

17. Copy-paste quick commands

# Region and identity
aws configure get region
aws sts get-caller-identity

# Lambda landscape
aws lambda list-functions --region ap-south-1 --max-items 20 \
  --query 'Functions[].{N:FunctionName,R:Runtime,T:Timeout,M:MemorySize}' --output table
aws lambda get-account-settings --region ap-south-1

# API Gateway (HTTP APIs)
aws apigatewayv2 get-apis --region ap-south-1 --query 'Items[].{N:Name,Id:ApiId,Ep:ProtocolType}' --output table

# Queues and topics
aws sqs list-queues --region ap-south-1
aws sns list-topics --region ap-south-1 --query 'Topics[].TopicArn'

# Event buses and state machines
aws events list-event-buses --region ap-south-1
aws stepfunctions list-state-machines --region ap-south-1 --query 'stateMachines[].name'

# DynamoDB tables (names only)
aws dynamodb list-tables --region ap-south-1

Sandbox + read-only IAM.

18. अजून industry आणि stack stories

  • Fintech Lagos: webhook → SQS → idempotent ledger.
  • Ecommerce Pune: throttle + fan-out.
  • Healthcare SG: SNS + PHI IAM.
  • EdTech: EventBridge cleanup.
  • Logistics: bus + saga.
  • Media: avoid recursive S3.
  • SaaS: tenant partition.
  • Gov: strangler peel.
  • Startup: Function URL → HTTP API.
  • Retail: FIFO vs Standard.
  • Python: thin handlers.
  • Node: async/await.
  • Java: SnapStart.
  • .NET: package size.
  • Go: static binary.
  • PHP: hybrid.

19. Glossary

Termअर्थ
Cold startपहिल्या invoke ची init
Idempotencyदोनदा = तोच effect
DLQFail झालेले messages
ChoreographyEvents; conductor नाही
OrchestrationSFN central
Fan-outएक → अनेक
Fan-inअनेक → join
Strangler figMonolith peel
SagaSteps + compensate
Provisioned concurrencyWarm N; pay

20. Practice: मोठ्याने explain

  1. 60s: multi-region serverless गोष्ट.
  2. 60s: sync vs async checkout.
  3. 60s: Lambda नको कधी.
  4. 60s: DLQ + idempotency.
  5. Record ×2.

21. Safe lab hygiene

  • Tag owner+expiry.
  • Budget alarm आधी.
  • Read-only first.
  • Cleanup.
  • No secrets in env/screenshots.
  • No provisioned on hello.

23. Myths

Mythखरं
Servers नाहीतServers आहेत; manage नको
नेहमी स्वस्तSteady वर EC2
No OpsIAM/data/alarms
एक LambdaBounded contexts
Queues optionalLoad leveler

24. Serverless error budget

Checkout error budget 0.1% असेल तर aggressive retries email duplicates देऊन budget जाळू शकतात. Money SLO ≠ notify SLO.

  1. दोन SLOs.
  2. Money retries bounded.
  3. Notify best-effort.
  4. Money page; notify ticket.

25. Regional notes (ap-south-1)

  • Labs Mumbai.
  • Feature availability.
  • Data residency.
  • Latency India.

26. Naming conventions

# Suggested prefixes
# Lambda:  pay-intake-prod, pay-worker-prod
# SQS:     pay-orders.fifo / pay-orders-dlq
# SNS:     pay-order-events
# EB bus:  pay.domain
# SFN:     pay-refund-saga
# DDB:     pay-orders-prod

env + domain नावात ठेवा. CloudWatch grep सोपा.

27. Pre-mortems

  1. Double charge headline.
  2. DLQ drain plan.
  3. Cognito outage mode.
  4. Runbook.

28. Currency / locale

Currencies आणि names rotate करा — global mental model.

29. SEA + Mumbai

  1. RPO/RTO set.
  2. AP+GT reads.
  3. DNS+/healthz.
  4. Game day.

30. Anti-patterns

  • Dual stock writers.
  • Paper-only DR.
  • Unsafe DR copy.

उजळणी, मुलाखत आणि तुलना cards

हा lesson काही मिनिटांत revise करा. Cards phone वर save करा किंवा PNG download करा. प्रत्येक card वरचा QR हा lesson उघडतो.

उजळणी card: Agree RPO/RTO first. Stacks ≠ DR. RPO + RTO. Mode + data. Write then build.
उजळणी card: Agree RPO/RTO first · PNG download करा · Card page उघडा
उजळणी card: Rehearse failover. Paper fails. User healthz. Idempotency. Game day.
उजळणी card: Rehearse failover · PNG download करा · Card page उघडा
तुलना: Active-passive vs Active-active writes. Active-passive: Standby. Active-active writes: Dual writes.
तुलना: Active-passive vs Active-active writes · PNG download करा · Card page उघडा
तुलना: Copy stacks only vs Stacks + data plan. Copy stacks only: Stacks only. Stacks + data plan: Data plan.
तुलना: Copy stacks only vs Stacks + data plan · PNG download करा · Card page उघडा
मुलाखत card: Active-passive?. One serves. Lag vs RPO. Game day date.
मुलाखत card: Active-passive? · PNG download करा · Card page उघडा
मुलाखत card: Global Tables?. Managed replicate. LWW care. Name one.
मुलाखत card: Global Tables? · PNG download करा · Card page उघडा
मुलाखत card: Health check design?. User-facing. Thresholds. Postmortem link.
मुलाखत card: Health check design? · PNG download करा · Card page उघडा
मुलाखत card: Why cross-region idempotency?. Duplicate writes. Deterministic ids. orderId + region.
मुलाखत card: Why cross-region idempotency? · PNG download करा · Card page उघडा

अजून cards: Ravi Sir's Cards.

सराव Tasks

या scenario बद्दल

Amravati Agro Market हा अमरावती मधला शेती व्यवसाय आहे. Anjali Thakre त्यांचं IT व cloud काम पाहतात. त्यांचे पैसे INR मध्ये मोजले जातात आणि AWS resources ap-south-1 Region मध्ये चालतात. खालच्या tasks मध्ये तुम्ही या lesson मध्ये शिकलेलं वापरून त्यांची खरी कामं करता. सगळी नावं, account IDs, IP addresses व numbers सरावासाठी काल्पनिक आहेत.

0 / 16

सोपं RPO

का: Idea.

काय करायचं: RPO तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

सोपं RTO

का: Idea.

काय करायचं: RTO तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

सोपं AP

का: Idea.

काय करायचं: AP तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

सोपं AA

का: Idea.

काय करायचं: Conflicts तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

सोपं GT

का: Idea.

काय करायचं: GT तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

सोपं DNS

का: Idea.

काय करायचं: R53 तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

सोपं LWW

का: Idea.

काय करायचं: LWW तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

मध्यम HC

का: Idea.

काय करायचं: User HC तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

मध्यम Idem

का: Idea.

काय करायचं: Idem तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

मध्यम Data

का: Idea.

काय करायचं: Data plan तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

मध्यम Game

का: Idea.

काय करायचं: Game day तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

मध्यम Pilot

का: Idea.

काय करायचं: Pilot तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

मध्यम SLO

का: Agree.

काय करायचं: rpo + rto.

कसं करायचं:
  1. Task मधल्या top-level keys पासून सुरू करा.
  2. Child keys 2 spaces ने indent करा (tabs नकोत).
  3. प्रत्येक property मध्ये task मधली value भरा.
  4. Check answer दाबा. Keys चा क्रम महत्त्वाचा नाही.

मध्यम R53

का: DNS.

काय करायचं: zones.

कसं करायचं:
  1. Task वाचा आणि ते कोणत्या AWS service बद्दल आहे ते ठरवा.
  2. aws लिहा, मग service चं नाव, मग operation (action शब्द).
  3. प्रत्येक आवश्यक flag (--name) व त्यापुढे task मधली value लिहा.
  4. Flags कोणत्याही क्रमाने चालतात. Check answer दाबा.

अवघड Stock

का: Idea.

काय करायचं: Double-sell तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

अवघड Sec

का: Idea.

काय करायचं: Per region तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.