Disaster Recovery on AWS
A disaster is any event with a negative impact on business continuity or finances; DR is preparing for it and recovering from it. Every DR question collapses to two numbers — how much data you can afford to lose (RPO) and how long you can afford to be down (RTO). Everything else is just how much you're willing to pay to shrink them.
Thảm hoạ là bất kỳ sự kiện nào gây tác động xấu tới tính liên tục kinh doanh hoặc tài chính; DR là chuẩn bị cho nó và phục hồi sau nó. Mọi câu hỏi về DR đều quy về hai con số — mất bao nhiêu dữ liệu là chấp nhận được (RPO) và chết bao lâu là chấp nhận được (RTO). Phần còn lại chỉ là bạn chịu trả bao nhiêu tiền để thu nhỏ hai con số đó.
Reach for it / not the right toolKhi nào dùng / khi nào không
The exam almost never asks "is DR needed" — it asks which strategy the stated numbers actually justify. Read the RPO/RTO in the question first, then pick the cheapest tier that clears them. Over-building is a wrong answer. Đề thi hầu như không hỏi "có cần DR không" — nó hỏi những con số đưa ra biện minh cho chiến lược nào. Đọc RPO/RTO trong đề trước, rồi chọn bậc rẻ nhất vẫn đạt. Xây quá tay là đáp án sai.
Climb the ladder when…Leo lên bậc cao hơn khi…
- RTO is stated in minutes or seconds and every minute down costs real revenue → Warm Standby at the very least, Multi-Site if "no downtime" appears.RTO ghi bằng phút hoặc giây và mỗi phút chết mất doanh thu thật → ít nhất là Warm Standby, và Multi-Site nếu đề có chữ "không được gián đoạn".
- The database is the slow part — restoring it takes hours. Pilot Light pays for itself: keep it replicating, leave the app tier off.Database mới là phần chậm — khôi phục nó mất hàng giờ. Pilot Light đáng đồng tiền: giữ nó sao chép liên tục, còn tầng app thì tắt.
- A whole Region is the blast radius in the question, or users are already active in two geographies → two Regions, active-active, Aurora Global Database.Đề lấy cả một Region làm phạm vi sự cố, hoặc người dùng vốn đã hoạt động ở hai vùng địa lý → hai Region, active-active, Aurora Global Database.
- Regulators require a demonstrated, regularly exercised failover — you can only rehearse what is already running.Cơ quan quản lý yêu cầu failover chứng minh được và diễn tập định kỳ — chỉ diễn tập được thứ vốn đã chạy sẵn.
Don't buy the hotter tier when…Đừng mua bậc nóng hơn khi…
- The stated RTO is hours or a day and cost is the priority → Backup & Restore. Snapshots plus S3 lifecycle to Glacier, nothing running.RTO đề ra là vài giờ hoặc một ngày và ưu tiên là chi phí → Backup & Restore. Snapshot cộng vòng đời S3 xuống Glacier, không chạy gì cả.
- The threat is accidental deletion or corruption, not a site loss → versioning, backups and retention. A second Region does not protect you from a bad
DELETEthat replicates.Mối đe doạ là xoá nhầm hoặc hỏng dữ liệu, không phải mất cả site → versioning, backup và thời hạn lưu. Region thứ hai không cứu bạn khỏi một câuDELETEsai vì nó cũng được sao chép sang. - The requirement is really surviving one AZ → Multi-AZ and an ASG across AZs. That's high availability, not DR; answering "multi-Region" is over-building.Yêu cầu thật ra là sống sót khi mất một AZ → Multi-AZ và ASG trải nhiều AZ. Đó là high availability, không phải DR; trả lời "multi-Region" là xây quá tay.
- The stack is stateless and fully in IaC — CloudFormation rebuilds it in 20 minutes. Keep a pilot light for the data only.Hệ thống không giữ trạng thái và đã ở dạng IaC — CloudFormation dựng lại trong 20 phút. Chỉ cần pilot light cho phần dữ liệu.
RPO and RTO — the two numbersRPO và RTO — hai con số
Draw the timeline every time. RPO looks backwards from the disaster to the last good copy and answers "how much data did we lose?". RTO looks forwards from the disaster to service restored and answers "how long were we down?". Shrinking RPO means replicating more often; shrinking RTO means keeping more of the stack running. Both cost money. Lần nào cũng vẽ lại trục thời gian. RPO nhìn về sau, từ thảm hoạ lùi về bản sao tốt cuối cùng, trả lời "mất bao nhiêu dữ liệu?". RTO nhìn về trước, từ thảm hoạ tới lúc dịch vụ chạy lại, trả lời "chết bao lâu?". Thu nhỏ RPO nghĩa là sao chép dày hơn; thu nhỏ RTO nghĩa là giữ nhiều thành phần chạy sẵn hơn. Cả hai đều tốn tiền.
The two numbers are independent. A nightly snapshot with instant restore gives you a 24-hour RPO and a 10-minute RTO; continuous replication into a cold Region gives the opposite. Questions love that asymmetry.
Hai con số này độc lập với nhau. Snapshot hằng đêm nhưng khôi phục tức thì cho RPO 24 giờ và RTO 10 phút; sao chép liên tục vào một Region nguội thì ngược lại. Đề thi rất thích sự bất đối xứng đó.
Three shapes of DRBa hình thái DR
The four strategiesBốn chiến lược
One dial, four notches. The only thing that changes across it is how much of the stack you pay to keep running before anything breaks — and that is precisely what buys down RTO. Một cái núm vặn, bốn nấc. Thứ duy nhất thay đổi dọc theo nó là bạn trả tiền giữ bao nhiêu phần của hệ thống chạy sẵn trước khi có sự cố — và đúng thứ đó mới mua được RTO thấp.
Dashed box = switched off, solid = running and being paid for. Notice the jump that actually matters: Pilot Light to Warm Standby is where the app tier stops being a cold AMI and starts being a live, patched, load-balanced fleet.
Khung nét đứt = đang tắt, khung đặc = đang chạy và đang tính tiền. Để ý bước nhảy thật sự quan trọng: từ Pilot Light sang Warm Standby là lúc tầng app thôi làm một AMI nguội và trở thành cụm máy sống, đã vá lỗi, có load balancer.
| StrategyChiến lược | What's runningĐang chạy cái gì | RPO | RTO | Relative costChi phí tương đối |
|---|---|---|---|---|
| Backup & RestoreBackup & Restore | nothing — only snapshots and objects sitting in S3/Glacierkhông gì cả — chỉ có snapshot và object nằm trong S3/Glacier | hours (the snapshot interval)vài giờ (bằng chu kỳ snapshot) | hours to daysvài giờ tới vài ngày | $ — storage only$ — chỉ tốn lưu trữ |
| Pilot LightPilot Light | the critical core only — the database, replicating continuously; app servers offchỉ phần lõi quan trọng — database, sao chép liên tục; app server tắt | minutes (replication lag)vài phút (độ trễ sao chép) | tens of minutes — boot the app tiervài chục phút — khởi động tầng app | $$ — one small always-on database$$ — một database nhỏ chạy suốt |
| Warm StandbyWarm Standby | the full system, at minimum size — ELB live, ASG at its floortoàn bộ hệ thống, ở kích thước tối thiểu — ELB đang sống, ASG ở mức sàn | secondsvài giây | minutes — scale up to production loadvài phút — scale lên tải production | $$$ — a whole small copy, always$$$ — luôn giữ một bản sao nhỏ đầy đủ |
| Multi-Site / Hot SiteMulti-Site / Hot Site | full production scale in both places, active-active behind Route 53đủ quy mô production ở cả hai nơi, active-active sau Route 53 | near zerogần bằng không | minutes or secondsvài phút hoặc vài giây | $$$$ — you pay twice, permanently$$$$ — trả gấp đôi, vĩnh viễn |
Backup and Restore — highest RPO/RTO, cheapestBackup and Restore — RPO/RTO cao nhất, rẻ nhất
Nothing runs. Data gets to AWS by Storage Gateway for a steady trickle or Snowball for a bulk seed; inside AWS you take regular scheduled snapshots of EBS, RDS and Redshift, and push objects to S3 with a lifecycle rule down to Glacier. On the day, you launch EC2 from an AMI and restore RDS from its snapshot. Không có gì chạy cả. Dữ liệu vào AWS qua Storage Gateway nếu chảy đều, hoặc Snowball nếu cần nạp khối lượng lớn ban đầu; bên trong AWS thì chụp snapshot theo lịch đều đặn cho EBS, RDS và Redshift, và đẩy object lên S3 kèm lifecycle xuống Glacier. Đến ngày sự cố, bạn dựng EC2 từ một AMI và khôi phục RDS từ snapshot.
- RPO is exactly your snapshot interval. Nightly snapshots = up to 24 hours of data gone. If the question tightens RPO but leaves RTO loose, the fix is more frequent copies, not a hotter strategy. RPO đúng bằng chu kỳ snapshot. Snapshot hằng đêm = mất tới 24 giờ dữ liệu. Nếu đề siết RPO nhưng vẫn nới RTO, cách sửa là sao chép dày hơn, không phải nhảy lên bậc nóng hơn.
- Snapshots are Regional. If the DR Region matters, copy the snapshots and AMIs there, and turn on cross-Region replication on the buckets — otherwise your backups die with the Region. AWS Backup does this on a policy instead of a pile of Lambda jobs. Snapshot mang tính Region. Nếu Region DR có ý nghĩa, hãy sao snapshot và AMI sang đó, và bật cross-Region replication cho bucket — nếu không, backup chết cùng Region. AWS Backup làm việc này bằng policy thay vì một đống job Lambda.
Pilot Light — the critical core stays litPilot Light — giữ lửa cho phần lõi
A small version of the app is always running in the cloud — just the critical core, which in practice means the database, replicating continuously from production. App servers are provisioned but switched off. Very similar to Backup and Restore, and faster only because the slow part is already up. Một bản thu nhỏ của ứng dụng luôn chạy trên cloud — chỉ phần lõi quan trọng, mà trên thực tế là database, sao chép liên tục từ production. App server đã chuẩn bị sẵn nhưng đang tắt. Rất giống Backup and Restore, và nhanh hơn chỉ vì phần chậm nhất đã chạy sẵn.
- The off-switch is the whole point — you pay for one small database and nothing else. On disaster: start the instances from their AMIs, point Route 53 at the recovered site. Cái công tắc tắt chính là điểm mấu chốt — bạn chỉ trả tiền cho một database nhỏ, ngoài ra không gì. Khi có sự cố: bật instance từ AMI, trỏ Route 53 sang site đã phục hồi.
- Its weakness is that the cold app tier drifts. An AMI baked six months ago boots into an unpatched, mis-configured mess exactly when you need it. Rebuild it from CloudFormation on a schedule instead of trusting a stale image. Điểm yếu là tầng app nguội sẽ lệch dần. Một AMI nướng từ sáu tháng trước sẽ khởi động thành một mớ chưa vá, cấu hình sai — đúng lúc bạn cần nó nhất. Hãy dựng lại từ CloudFormation theo lịch thay vì tin vào một image cũ.
Warm Standby — everything up, just smallWarm Standby — mọi thứ đều chạy, chỉ là nhỏ
The full system is up and running but at minimum size: reverse proxy and app servers on-premises, and in AWS an ELB with an Auto Scaling group at its floor plus a running secondary database. Upon disaster you scale it to production load, and Route 53 shifts traffic from the on-premises reverse proxy to the ELB. Toàn bộ hệ thống chạy nhưng ở kích thước tối thiểu: reverse proxy và app server ở on-premises, còn trên AWS là ELB với Auto Scaling group ở mức sàn cộng một database phụ đang chạy. Khi có sự cố, bạn scale lên tải production, và Route 53 chuyển lưu lượng từ reverse proxy on-premises sang ELB.
- Because it is genuinely running, it is the cheapest tier you can actually test — send 1% of real traffic at it and you know it works. That is usually the deciding argument in an exam scenario about audits or drills. Vì nó thật sự đang chạy, đây là bậc rẻ nhất mà bạn kiểm thử thật được — đẩy 1% lưu lượng thật vào là biết ngay nó có chạy không. Trong các tình huống thi về audit hay diễn tập, đó thường là lập luận quyết định.
- RTO is now bounded by how fast you can scale, not by how fast you can build. Watch the service quotas in the standby Region — an ASG that cannot get instances has an infinite RTO. Giờ RTO bị chặn bởi tốc độ scale, không phải tốc độ dựng. Hãy để mắt tới service quota ở Region dự phòng — một ASG không xin được instance thì RTO là vô hạn.
Multi-Site / Hot Site — both at full scaleMulti-Site / Hot Site — cả hai đều đủ quy mô
Full production scale running in both places, active-active, with Route 53 sending live traffic to each. RTO in minutes or seconds because there is nothing to start — and very expensive, because you are paying for two production estates forever. Cả hai nơi đều chạy đủ quy mô production, active-active, Route 53 gửi lưu lượng thật vào cả hai bên. RTO tính bằng phút hoặc giây vì chẳng có gì phải khởi động — và rất đắt, vì bạn trả tiền cho hai hệ thống production mãi mãi.
- "Active-active" is a data problem, not a traffic problem. Route 53 is easy; two sites writing to one logical dataset is where the design actually lives. "Active-active" là bài toán dữ liệu, không phải bài toán lưu lượng. Route 53 thì dễ; chỗ thật sự cần thiết kế là hai site cùng ghi vào một tập dữ liệu logic.
- If the question says "no downtime" or "seconds", this is the answer — but check it also says cost is not a constraint. If it says "cost-effective" in the same sentence, the answer is Warm Standby. Nếu đề nói "không được gián đoạn" hoặc "vài giây", đây là đáp án — nhưng phải xem đề có nói chi phí không phải ràng buộc không. Nếu cùng câu đó có chữ "tiết kiệm chi phí", đáp án là Warm Standby.
All-AWS multi-RegionMulti-Region thuần AWS
Same hot-site shape, both halves in AWS. Route 53 marks both Regions active; each Region has its own ELB and Auto Scaling group at production size; the data layer is an Aurora Global Database with the primary in Region A replicating to a secondary in Region B, and failover promotes the secondary. Vẫn là hình hot-site, chỉ khác là cả hai nửa đều nằm trên AWS. Route 53 đánh dấu cả hai Region là active; mỗi Region có ELB và Auto Scaling group riêng ở quy mô production; tầng dữ liệu là Aurora Global Database với primary ở Region A sao chép sang secondary ở Region B, và failover sẽ thăng cấp secondary lên.
DR tips, grouped the way questions areMẹo DR, gom theo cách đề hay hỏi
Five buckets. Most scenario questions are a single sentence from one of them, dressed up — recognise the bucket and the service list is short. Năm nhóm. Phần lớn câu hỏi tình huống chỉ là một câu lấy từ một nhóm, khoác thêm bối cảnh — nhận ra nhóm thì danh sách service còn lại rất ngắn.
AWS Fault Injection Simulator (FIS)AWS Fault Injection Simulator (FIS)
A managed service for running fault injection experiments on AWS workloads, based on chaos engineering: stress an application by creating disruptive events — a sudden spike in CPU or memory, an instance terminated, a database failed over — observe how the system responds, then implement improvements. It surfaces hidden bugs and performance bottlenecks that no amount of staging traffic will. Dịch vụ được quản lý để chạy thí nghiệm bơm lỗi lên workload trên AWS, dựa trên chaos engineering: gây căng thẳng cho ứng dụng bằng các sự kiện phá hoại — CPU hoặc bộ nhớ đột ngột tăng vọt, một instance bị tắt, một database bị failover — quan sát hệ thống phản ứng ra sao, rồi cải thiện. Nó lôi ra được lỗi ẩn và điểm nghẽn hiệu năng mà lưu lượng trên staging không bao giờ chạm tới.
tier=web".
EC2, ECS, EKS, RDS và nhiều hơn nữa — chọn theo tag hoặc theo tài nguyên, nên một thí nghiệm có thể nhắm vào "mọi instance có tag tier=web".
scoped by taggiới hạn theo tag
Things that catch you outNhững chỗ dễ vấp
- Multi-AZ is high availability, not disaster recovery. It survives an AZ; it does not survive a Region, a bad deployment or a deleted table. Questions blur the two on purpose — look for the word "Region" or "site" before reaching for a second Region. Multi-AZ là high availability, không phải disaster recovery. Nó sống sót khi mất một AZ; nó không sống sót khi mất một Region, khi deploy hỏng, hay khi bảng bị xoá. Đề cố tình làm mờ ranh giới — hãy tìm chữ "Region" hoặc "site" trước khi vội chọn Region thứ hai.
- An untested restore is not a backup. The classic failure is discovering at hour three that the snapshot restores but the application cannot find its config, its secrets or its DNS. RTO is measured on the whole path, not on the database. Bản khôi phục chưa từng thử không phải là backup. Kịch bản thất bại kinh điển là tới giờ thứ ba mới phát hiện snapshot khôi phục được nhưng ứng dụng không tìm thấy config, secret hay DNS của nó. RTO đo trên toàn bộ đường đi, không chỉ trên database.
- Route 53 TTL is part of your RTO. A 300-second TTL means five minutes of clients still pointing at the dead site after a perfect failover. Lower it before you need it — lowering it during an outage does nothing for records already cached. TTL của Route 53 là một phần RTO của bạn. TTL 300 giây nghĩa là sau một cú failover hoàn hảo vẫn còn năm phút client trỏ vào site đã chết. Hãy hạ TTL trước khi cần — hạ trong lúc sự cố chẳng giúp gì cho bản ghi đã nằm trong cache.
- Replication copies your mistakes too. A dropped table or a ransomware encrypt reaches the secondary in seconds. Replication buys you RPO against infrastructure loss only — you still need immutable, retained backups for the logical disasters. Sao chép cũng nhân bản cả sai lầm của bạn. Một bảng bị drop hay một đợt mã hoá tống tiền sẽ tới secondary trong vài giây. Sao chép chỉ mua RPO cho mất mát hạ tầng — bạn vẫn cần backup bất biến, có thời hạn lưu, cho các thảm hoạ logic.
- The DR Region has its own quotas, AMIs, KMS keys and limits. Snapshots encrypted with a Region-local key cannot be restored elsewhere, and an ASG cannot scale into capacity you were never granted. This is what turns a "minutes" RTO into an afternoon. Region DR có quota, AMI, khoá KMS và giới hạn riêng của nó. Snapshot mã hoá bằng khoá cục bộ của một Region không khôi phục được ở nơi khác, và ASG không thể scale vào phần capacity bạn chưa từng được cấp. Đây chính là thứ biến RTO "vài phút" thành cả một buổi chiều.
- Don't run a chaos experiment without a stop condition. FIS will happily do exactly what you asked; the CloudWatch alarm is what stops the test from becoming the incident. Đừng chạy thí nghiệm chaos mà không có điều kiện dừng. FIS sẽ vui vẻ làm đúng những gì bạn bảo; alarm CloudWatch mới là thứ ngăn bài kiểm thử biến thành chính sự cố.
Exam reflexesPhản xạ khi thi
| The question says…Đề nói… | AnswerTrả lời |
|---|---|
| "RTO of 24 hours, lowest possible cost""RTO 24 giờ, chi phí thấp nhất có thể" | Backup & Restore — snapshots plus S3 lifecycle to Glacier, nothing runningBackup & Restore — snapshot cộng lifecycle S3 xuống Glacier, không chạy gì |
| "Recover in tens of minutes; the database must be current""Phục hồi trong vài chục phút; database phải mới nhất" | Pilot Light — DB replicating and running, app servers off until neededPilot Light — DB chạy và sao chép liên tục, app server tắt cho tới khi cần |
| "The whole environment must already exist and just scale up on failover""Toàn bộ môi trường phải có sẵn và chỉ cần scale lên khi failover" | Warm Standby — full stack at minimum size, Route 53 shifts traffic to the ELBWarm Standby — toàn bộ stack ở kích thước tối thiểu, Route 53 dời lưu lượng sang ELB |
| "RTO in seconds, no data loss, cost is not a concern""RTO tính bằng giây, không mất dữ liệu, chi phí không thành vấn đề" | Multi-Site / hot site — full scale both sides, active-active via Route 53Multi-Site / hot site — đủ quy mô cả hai bên, active-active qua Route 53 |
| "Two Regions, active-active, one relational database""Hai Region, active-active, một database quan hệ" | Route 53 + ELB/ASG per Region + Aurora Global Database; failover promotes the secondaryRoute 53 + ELB/ASG mỗi Region + Aurora Global Database; failover thăng cấp secondary |
| "Must survive the loss of one Availability Zone""Phải sống sót khi mất một Availability Zone" | Multi-AZ and an ASG across AZs — that's HA. Don't answer multi-RegionMulti-AZ và ASG trải nhiều AZ — đó là HA. Đừng trả lời multi-Region |
| "Validate the app survives a sudden CPU spike or an instance being killed""Kiểm chứng ứng dụng sống sót khi CPU tăng vọt hoặc bị tắt một instance" | AWS FIS — pre-built experiment template, with a CloudWatch alarm as the stop conditionAWS FIS — template thí nghiệm dựng sẵn, dùng alarm CloudWatch làm điều kiện dừng |
| "The Direct Connect link to the DR site fails""Đường Direct Connect tới site DR bị hỏng" | A Site-to-Site VPN as the backup path — cheap, and the expected answerDùng Site-to-Site VPN làm đường dự phòng — rẻ, và là đáp án được mong đợi |