RDS & Amazon Aurora
Managed relational engines. RDS runs the OS/patching for the big-six engines; Aurora rebuilds MySQL/Postgres storage into a distributed 6-copy log. Exam themes: Multi-AZ vs read replicas, endpoints, Global DB, RDS Proxy.
Relational managed. RDS lo OS/patching cho 6 engine phổ biến; Aurora tự viết lại storage MySQL/Postgres thành log phân tán 6 bản. Chủ đề exam: Multi-AZ vs read replica, endpoint, Global DB, RDS Proxy.
RDS at a glanceRDS tổng quan
Six engines · EBS-backed storage with auto-scaling · lives in a VPC subnet · backups + PITR out of the box. 6 engine · storage EBS auto-scale · sống trong VPC subnet · backup + PITR sẵn.
Multi-AZ vs Read ReplicasMulti-AZ vs Read Replica
| Multi-AZ | Read Replicas | |
|---|---|---|
| PurposeMục đích | Failover / HAFailover / HA | Read scaleScale đọc |
| Serves reads?Đọc được? | ❌ | ✅ |
| ReplicationReplication | SyncĐồng bộ | Async · eventualBất đồng bộ · eventual |
| Cross-region?Cross-region? | ❌ | ✅ |
Aurora storage & HAAurora storage & HA
- 6 copies across 3 AZ. Self-healing peer-to-peer replication, striped across 100s of volumes.6 bản trên 3 AZ. Replication peer-to-peer tự chữa lành, chia trên hàng trăm volume.
- Failover of the writer in <30 s. Up to 15 Aurora Read Replicas per cluster.Writer failover <30 s. Tối đa 15 Aurora Read Replica mỗi cluster.
- Direct S3 load / export — no client middleman needed.Load / export trực tiếp từ S3 — không cần client trung gian.
Aurora endpointsAurora endpoint
Aurora Serverless & Data APIAurora Serverless & Data API
- Aurora Serverless auto-instantiates and scales. Good for spiky, intermittent, unpredictable workloads.Aurora Serverless tự spawn và scale. Tốt cho load bùng nổ, gián đoạn, khó đoán.
- Serverless v2 scales 0–256 ACUs in-place (no connection drop); 0 ACU = auto-pause, resume ~15 s. Can mix serverless + provisioned instances in one cluster. v1 is retired (EOL Mar 2025).Serverless v2 scale 0–256 ACU tại chỗ (không rớt connection); 0 ACU = auto-pause, resume ~15 s. Trộn được instance serverless + provisioned trong 1 cluster. v1 đã nghỉ hưu (EOL 3/2025).
- Data API = HTTPS endpoint for SQL — no JDBC / connection pooling. App needs perms on Data API and Secrets Manager (for creds).Data API = endpoint HTTPS để chạy SQL — không JDBC / pooling. App cần quyền Data API và Secrets Manager (đọc cred).
RDS ProxyRDS Proxy
Pools connections. Fixes "TooManyConnections" from bursty Lambda. Supports IAM or password auth. Speeds failover. Pool connection. Chữa "TooManyConnections" khi Lambda bùng nổ. Hỗ trợ IAM hoặc password. Tăng tốc failover.
- Reach it via public proxy → public Lambda or private proxy → Lambda in VPC.Kết nối: public proxy → public Lambda hoặc private proxy → Lambda trong VPC.
- For Aurora, add a read-only proxy endpoint against the reader replicas.Với Aurora, có thể tạo proxy endpoint read-only tới reader replica.
Global & DRGlobal & DR
| Aurora cross-region RRAurora cross-region RR | Aurora Global DB | |
|---|---|---|
| RegionsRegion | 1 + 1 | 1 + up to 10 |
| Replication lagLag | Best-effortBest-effort | < 1 s |
| RTO on promotionRTO khi promote | — | < 1 min |
| Write forwardingWrite forwarding | ❌ | ✅ (writes sent to primary)(ghi chuyển về primary) |
Migrate & convertMigrate & convert
- RDS → Aurora: restore a DB snapshot into Aurora, or attach an Aurora Read Replica to the RDS instance and promote.RDS → Aurora: restore snapshot vào Aurora, hoặc gắn Aurora Read Replica vào RDS rồi promote.
- RDS Oracle: use RDS Backups to restore back to RDS · use Oracle RMAN to restore to non-RDS · no RAC on RDS · TDE for storage encryption.RDS Oracle: RDS Backups để restore về RDS · Oracle RMAN để restore ra ngoài RDS · không có RAC trên RDS · TDE mã hoá storage.
- RDS MySQL: native
mysqldumpto migrate to non-RDS (on-prem or EC2).RDS MySQL: dùngmysqldumpđể migrate ra non-RDS (on-prem hoặc EC2). - Blue/Green deployments (RDS MySQL · MariaDB · PostgreSQL + Aurora MySQL · PostgreSQL): synced staging copy, switchover typically <1 min — near-zero-downtime major upgrades / schema changes.Blue/Green deployment (RDS MySQL · MariaDB · PostgreSQL + Aurora MySQL · PostgreSQL): bản staging sync sẵn, switchover thường <1 phút — upgrade major / đổi schema gần như không downtime.
Aurora cloning & moving a database between accountsClone Aurora & chuyển database sang account khác
An Aurora clone is copy-on-write: the new cluster starts by sharing the source's storage pages and only diverges as either side writes. It's near-instant on a multi-TB database, where restoring a snapshot is a full copy. Một clone Aurora là copy-on-write: cluster mới bắt đầu bằng cách dùng chung các trang storage của nguồn và chỉ tách ra khi một trong hai bên ghi. Nó gần như tức thì trên database nhiều TB, trong khi restore snapshot là copy toàn bộ.
| Clone (copy-on-write)Clone (copy-on-write) | Restore from snapshotRestore từ snapshot | |
|---|---|---|
| Time to usableThời gian tới lúc dùng được | minutes, near-independent of sizevài phút, gần như không phụ thuộc dung lượng | scales with the data volumetỉ lệ theo dung lượng dữ liệu |
| Initial storage costChi phí storage ban đầu | shared pages, pay only for divergencedùng chung page, chỉ trả cho phần tách ra | a full second copymột bản sao thứ hai đầy đủ |
| Cross-accountCross-account | ✓ share the cluster with RAM, target account clones it✓ share cluster bằng RAM, account đích tự clone | ✓ but only a manual snapshot can be shared✓ nhưng chỉ snapshot manual mới share được |
| Same Region onlyChỉ cùng Region | ✓ | ✗ — copy the snapshot anywhere✗ — copy snapshot đi đâu cũng được |
| Reach for itDùng khi | test/staging copies · cross-account migration with minimal downtimebản test/staging · migration cross-account với downtime tối thiểu | DR · another Region · a point-in-time copy to keepDR · Region khác · một bản point-in-time để giữ lại |
- Automated snapshots cannot be shared. Copy one into a manual snapshot first — and if it's encrypted, share the KMS key with the target account too.Snapshot tự động không share được. Phải copy thành snapshot manual trước — và nếu có mã hoá, share luôn KMS key cho account đích.
- Cross-account clone is same-Region only. Crossing a Region boundary means snapshot-copy or a Global Database, not a clone.Clone cross-account chỉ cùng Region. Vượt Region là phải copy snapshot hoặc dùng Global Database, không phải clone.
- Lambda is not shareable through RAM. Moving a serverless app to another account means redeploying the function's package there — pair that with a RAM-shared Aurora clone for the database half.Lambda không share được qua RAM. Chuyển một app serverless sang account khác nghĩa là deploy lại package của function ở đó — ghép nó với Aurora clone share qua RAM cho nửa database.
Managed master passwordManaged master password
Set ManageMasterUserPassword: true and RDS generates the master password, stores it in Secrets Manager, and rotates it — with no rotation Lambda anywhere. Whenever this option appears among the choices, it's the lowest-overhead one.
Đặt ManageMasterUserPassword: true và RDS tự sinh master password, lưu vào Secrets Manager, và tự xoay — không có rotation Lambda nào cả. Hễ option này xuất hiện trong các lựa chọn, đó là cái ít overhead nhất.
Database:
Type: AWS::RDS::DBCluster
Properties:
Engine: aurora-mysql
MasterUsername: admin
ManageMasterUserPassword: true # RDS sinh + lưu vào Secrets Manager + tự rotate
MasterUserSecret:
KmsKeyId: !Ref DbKey # customer-managed key nếu security team cần kiểm soát
# mặc định rotate mỗi 7 ngày; secret do RDS sở hữu — đừng sửa giá trị bằng tay
- This covers the master user only. Application users still need a Secrets Manager secret with a rotation Lambda, or IAM database authentication.Cái này chỉ lo user master. User của ứng dụng vẫn cần secret Secrets Manager kèm rotation Lambda, hoặc IAM database authentication.
- Also available on Aurora, Redshift and DocumentDB — same idea, same wording in the exam.Cũng có trên Aurora, Redshift và DocumentDB — cùng ý tưởng, cùng cách diễn đạt trong đề.
- If the answer options only offer "Secrets Manager + rotation Lambda +
RotationSchedule", that's still correct — managed rotation just isn't on the menu.Nếu các đáp án chỉ có "Secrets Manager + rotation Lambda +RotationSchedule", cái đó vẫn đúng — chỉ là managed rotation không có trong thực đơn.
Writes don't scale by adding replicasThêm replica không scale được ghi
Aurora handles writes very well — better than RDS MySQL on gp2, because its storage layer is distributed and grows itself. But one cluster has one writer, and read replicas only take SELECTs. "High write latency → add read replicas" is a non-sequitur.
Aurora xử lý ghi rất tốt — tốt hơn RDS MySQL trên gp2, vì tầng storage của nó phân tán và tự lớn lên. Nhưng một cluster có một writer, và read replica chỉ nhận SELECT. "Write latency cao → thêm read replica" là suy luận không ăn nhập.
- Replicas help writes only indirectly: if the writer was spending 60% of its time serving reads, moving those away frees it up. If the workload is nearly all writes, ten replicas change nothing.Replica giúp ghi chỉ một cách gián tiếp: nếu writer đang dùng 60% thời gian phục vụ đọc, dời phần đó đi sẽ giải phóng nó. Nếu workload gần như toàn ghi, mười replica cũng không đổi gì.
- Real write levers: a bigger writer instance, Aurora I/O-Optimized, batched inserts, fewer indexes, table partitioning, a buffer in front (Kinesis/SQS), or application-level sharding.Đòn bẩy ghi thật sự: writer instance to hơn, Aurora I/O-Optimized, insert theo lô, bớt index, phân mảnh bảng, đệm phía trước (Kinesis/SQS), hoặc sharding ở tầng ứng dụng.
- Growth that keeps going up-and-to-the-right on simple key/time-range telemetry is a DynamoDB shape — it partitions horizontally, so write capacity grows with the key space instead of with one instance.Tăng trưởng cứ đi lên mãi trên telemetry đơn giản theo key/khoảng thời gian là hình dạng của DynamoDB — nó phân mảnh ngang, nên năng lực ghi lớn theo không gian khoá thay vì theo một instance.
- Stay relational when you need joins, foreign keys, multi-row transactions or ad-hoc SQL reporting. Aurora PostgreSQL Limitless Database is the sharded-writer option — but it isn't "Aurora MySQL + read replicas".Cứ ở lại quan hệ khi cần join, foreign key, transaction nhiều dòng hoặc báo cáo SQL tuỳ ý. Aurora PostgreSQL Limitless Database là lựa chọn có writer phân mảnh — nhưng nó không phải "Aurora MySQL + read replica".
- Reading through the cluster endpoint sends you to the writer. A read-only workload must use the reader endpoint — a single-word difference that decides several questions.Đọc qua cluster endpoint là đi vào writer. Workload chỉ đọc phải dùng reader endpoint — khác đúng một chữ mà quyết định vài câu hỏi.