Migration
AWS Database Migration Service (DMS)
Database Migration Service, SCT, 6Rs Migration Strategies, CDC
Tổng quan
AWS DMS (Database Migration Service) = Service giúp migrate databases từ on-premises, EC2, hoặc RDS sang AWS một cách dễ dàng.
Key Features
| Feature | Mô tả |
|---|---|
| Minimal downtime | Source DB vẫn hoạt động bình thường khi migrate |
| Continuous replication | Sync data liên tục (CDC - Change Data Capture) |
| Homogeneous | Cùng database engine (MySQL → MySQL) |
| Heterogeneous | Khác database engine (Oracle → Aurora) |
| Schema conversion | Tích hợp với SCT để convert schema |
6Rs Migration Strategies
[!IMPORTANT] 6Rs là các strategies để migrate workloads lên Cloud. Đây là kiến thức quan trọng cho exam!
Chi tiết từng Strategy
| Strategy | Ý nghĩa | Effort | Khi nào dùng? |
|---|---|---|---|
| Rehost | Lift & Shift - chuyển nguyên xi | Thấp | Migrate nhanh, không muốn thay đổi |
| Replatform | Thay đổi nhỏ để dùng managed services | Thấp-TB | Muốn giảm operational burden |
| Repurchase | Mua SaaS thay thế | TB | Có SaaS phù hợp, muốn outsource |
| Refactor | Viết lại cloud-native | Cao | Cần tối ưu performance, scalability |
| Retire | Tắt bỏ | Thấp | App không còn giá trị |
| Retain | Giữ on-prem | Không có | Chưa sẵn sàng, quá phức tạp |
Rehost vs Replatform (Hay hỏi trong exam!)
6Rs - Quick Reference
| Keyword trong câu hỏi | Strategy |
|---|---|
| "Move as-is", "no changes" | Rehost |
| "Reduce operational burden", "managed service" | Replatform |
| "Buy new software", "SaaS" | Repurchase |
| "Rewrite", "cloud-native", "microservices" | Refactor |
| "No longer needed", "decommission" | Retire |
| "Keep on-premises", "not ready" | Retain |
Cách hoạt động
Workflow
- Create Replication Instance - EC2 chạy DMS engine
- Create Source/Target Endpoints - Connection settings
- Create Replication Task - Define migration settings
- Start Migration - Full load + CDC (ongoing replication)
- Cutover - Switch app sang target DB (minimal downtime)
Migration Types
1. Homogeneous Migration (Cùng engine)
Source và Target cùng database engine → Không cần convert schema.
2. Heterogeneous Migration (Khác engine)
Source và Target khác database engine → CẦN convert schema trước.
Supported Databases
Sources (Nguồn)
| Category | Databases |
|---|---|
| On-premises | Oracle, SQL Server, MySQL, PostgreSQL, MariaDB, SAP, MongoDB |
| AWS | RDS (all engines), Aurora, S3, DocumentDB |
| Cloud | Azure SQL, Azure MySQL, Azure PostgreSQL |
Targets (Đích)
| Category | Databases |
|---|---|
| Relational | RDS, Aurora, Redshift, Oracle, SQL Server, MySQL, PostgreSQL |
| NoSQL | DynamoDB, DocumentDB, Neptune |
| Data Lake | S3 (Parquet, CSV, JSON) |
| Streaming | Kinesis Data Streams |
| Search | OpenSearch Service |
AWS Schema Conversion Tool (SCT)
AWS SCT = Tool convert database schema từ một engine sang engine khác.
SCT Features
| Feature | Mô tả |
|---|---|
| Assessment Report | Phân tích độ phức tạp của migration |
| Auto-convert | Tự động convert ~80-90% schema |
| Manual fixes | Highlight code cần sửa manual |
| Data extraction agents | Extract data từ data warehouses |
DMS vs SCT
| AWS DMS | AWS SCT | |
|---|---|---|
| Purpose | Migrate DATA | Convert SCHEMA |
| When to use | Mọi database migration | Chỉ khi heterogeneous migration |
| Output | Data trong target DB | SQL scripts cho schema |
| Runs on | AWS Cloud (Replication Instance) | Local machine (Desktop app) |
| Cost | Pay for replication instance | FREE |
Khi nào dùng cái nào?
Use Cases
1. On-Premises to AWS
2. Cloud to Cloud
3. Consolidation
4. Continuous Replication (CDC)
Pricing
| Component | Pricing |
|---|---|
| Replication Instance | Per hour (like EC2) |
| Storage | Per GB-month |
| Data Transfer | Standard AWS data transfer rates |
| SCT | FREE |
Instance sizing
| Size | vCPU | Memory | Use case |
|---|---|---|---|
| dms.t3.micro | 2 | 1 GB | Testing |
| dms.t3.medium | 2 | 4 GB | Small workloads |
| dms.r5.large | 2 | 16 GB | Production |
| dms.r5.xlarge | 4 | 32 GB | Large production |
Exam Tips
[!IMPORTANT] DMS = Migrate DATABASE với minimal downtime. SCT = Convert SCHEMA khi khác engine.
Keyword → Answer
| Keyword trong câu hỏi | Đáp án |
|---|---|
| "Migrate database to AWS" | AWS DMS |
| "Minimal downtime migration" | AWS DMS |
| "Continuous replication" | AWS DMS (CDC) |
| "Convert Oracle to Aurora" | AWS SCT (schema) + DMS (data) |
| "Same engine migration" | DMS only |
| "Different engine migration" | SCT + DMS |
Key Points
- DMS = Migrate DATA
- SCT = Convert SCHEMA (FREE, runs locally)
- Homogeneous (same engine) = DMS only
- Heterogeneous (different engine) = SCT + DMS
- Source DB không downtime khi migration
- CDC = Change Data Capture (continuous sync)
Common Scenarios
| Scenario | Solution |
|---|---|
| "Migrate MySQL to RDS MySQL" | DMS only |
| "Migrate Oracle to Aurora PostgreSQL" | SCT + DMS |
| "Keep data synced during migration" | DMS with CDC |
| "Migrate to data lake (S3)" | DMS to S3 |
| "Migrate data warehouse to Redshift" | SCT (data extraction) + DMS |