Day 30 - Database Migration & Best Practices

Date: 2025-10-17 (Friday)
Status: “Done”


Lecture Notes

AWS Database Migration Service (DMS)

AWS DMS helps migrate databases to AWS quickly and securely with minimal downtime.

Key Features:

  • Homogeneous Migrations: Same database engine (e.g., Oracle to Oracle)
  • Heterogeneous Migrations: Different engines (e.g., Oracle to Aurora)
  • Continuous Replication: Keep source and target in sync
  • Schema Conversion: AWS Schema Conversion Tool (SCT)

Migration Types:

  • Full Load: One-time migration of existing data
  • Full Load + CDC: Initial load plus ongoing changes
  • CDC Only: Replicate only ongoing changes

Supported Sources:

  • Oracle, SQL Server, MySQL, PostgreSQL, MongoDB, SAP ASE, IBM Db2
  • Amazon RDS, Amazon Aurora, Amazon S3

Supported Targets:

  • Amazon RDS, Amazon Aurora, Amazon Redshift, Amazon DynamoDB
  • Amazon S3, Amazon Elasticsearch, Amazon Kinesis Data Streams

Database Best Practices

Performance Optimization

RDS/Aurora:

  • Use appropriate instance types
  • Enable Enhanced Monitoring
  • Optimize queries and indexes
  • Use Read Replicas for read-heavy workloads
  • Enable Performance Insights

Redshift:

  • Choose appropriate distribution keys
  • Use sort keys for frequently filtered columns
  • Vacuum and analyze tables regularly
  • Use columnar compression
  • Implement workload management (WLM)

ElastiCache:

  • Choose appropriate node types
  • Use cluster mode for Redis scalability
  • Implement proper cache eviction policies
  • Monitor cache hit rates
  • Use connection pooling

Security Best Practices

  • Encryption at Rest: Enable for all databases
  • Encryption in Transit: Use SSL/TLS connections
  • Network Isolation: Deploy in private subnets
  • IAM Authentication: Use for RDS/Aurora when possible
  • Secrets Manager: Store database credentials securely
  • Security Groups: Restrict access to minimum required
  • Audit Logging: Enable CloudWatch Logs and CloudTrail

High Availability & Disaster Recovery

RDS/Aurora:

  • Enable Multi-AZ for production workloads
  • Configure automated backups
  • Test restore procedures regularly
  • Use Aurora Global Database for multi-region DR
  • Implement read replicas in different regions

Redshift:

  • Enable automated snapshots
  • Copy snapshots to other regions
  • Use Redshift Spectrum for data lake integration
  • Implement cross-region snapshot copy

ElastiCache:

  • Enable Multi-AZ with automatic failover (Redis)
  • Configure backup and restore (Redis)
  • Use cluster mode for Redis scalability
  • Implement application-level retry logic

Cost Optimization

  • Right-sizing: Choose appropriate instance types
  • Reserved Instances: Commit for 1-3 years for discounts
  • Aurora Serverless: For variable workloads
  • Redshift Serverless: For intermittent analytics
  • Storage Optimization: Use appropriate storage types
  • Lifecycle Policies: Archive old data to S3/Glacier
  • Monitor Usage: Use Cost Explorer and Budgets

Exploration

The Data Warehouse Toolkit

  • Canonical reference for dimensional modeling and DW design patterns.

Week 6 Summary

  • Hoàn thành nền tảng Database (RDBMS, NoSQL, OLTP vs OLAP).
  • Dịch vụ chính: RDS/Aurora, Redshift, ElastiCache, DMS.
  • Labs: RDS & EC2 Integration, Database Migration Service.

Tổng kết 6 tuần đầu (08/09 - 17/10/2025)

  • Week 1: Cloud fundamentals, infrastructure, management tools, cost optimization.
  • Week 2: Networking (VPC, security controls, load balancing, hybrid connectivity).
  • Week 3: Compute (EC2/AMI/storage, auto scaling, pricing models).
  • Week 4: Storage (S3/Glacier, Snow Family, Storage Gateway, backup & DR).
  • Week 5: Security & Identity (IAM, Cognito, Organizations/SCP, KMS, Security Hub).
  • Week 6: Databases (RDS, Aurora, Redshift, ElastiCache, DMS).
  • Labs hoàn thành: 25+ labs.
  • Tiếp theo: Tuần 7–8 bắt đầu từ 20/10/2025.