Bài lab này sẽ giúp bạn hiểu rõ hơn về AWS Database Migration Service(AWS DMS). Bạn sẽ di chuyển dữ liệu từ cơ sở dữ liệu Amazon Relational Database Service (Amazon RDS) Postgres hiện có sang Amazon Simple Storage Service (Amazon S3) bucket.

Link GitHub của lab - https://github.com/aws-samples/data-engineering-for-aws-immersion-day


Chọn Create subnet group
Tại DMS console, subnet group displays Complete


Name: DMS-Replication-Instance
Description: DMS Replication Instance
Instance class: dms.t3.medium
Chọn engine version mới nhất
High Availability: Dev or test workload (Single-AZ)
VPC: dmslstudv1

Chọn Advanced để mở rộng
Chọn security group là sgdefault

Tất cả các trường còn lại mặc định
DMS console hiển thị trạng thái tạo instance


Chọn Source Endpoint
Endpoint identifier: rds-source-endpoint
Source engine: PostgreSQL
Access to Endpoint database: Provide access information manually
Server name: RDS-Server-Name

Port: 5432
SSL mode: none
User name: adminuser
Password: admin123
Database name: sportstickets





Mở rộng phần: Endpoint settings
Chọn Use endpoint connection checkbox, điền addColumnName=true trong Extra connection attributes box

Mở rộng Test endpoint connection (optional). chọn VPC.
Chọn Run test. Bước này kết nối với source database. Nếu thành công sẽ hiển thị thông báo “Connection tested successfully”

Tại DMS console, chọn Database Migration Tasks.

Chọn Create Task.



Chọn Create task. Task sẽ được tạo và tự động start
Chọn task và xem chi tiết.


Khi hoàn thành, task console hiển thị 100% progress

Mở S3 console và xem data được copy bởi DMS

Review data bằng S3 select



Tại DMS console, chọn Endpoints

Nhấn Create endpoint
Endpoint type: Target
Endpoint identifier: rds-cdc-endpoint
Target engine: Amazon S3
Service Access Role ARN: DMSLabRoleS3
Bucket name: Chọn S3 Bucketname
Bucket folder: cdc

Mở rộng phần Endpoint settings
Tích vào checkbox Use endpoint connection attributes và nhập addColumnName=true. Thuộc tính này bao gồm tên cột từ dữ liệu nguồn.

Mở rộng phần Test endpoint connection (optional), chọn VPC name.
Click Run test. Nếu thành công sẽ hiển thị thông báo “Connection tested successfully”.
Chọn Create endpoint

Khi sẵn sàng, endpoint status chuyển sang active.




Chuyển đến Table Mappings
Chọn ** Add new selection rule ** và Chọn Enter a Schema tại Schema field
Tại Source name, chọn dms_sample. Tất cả còn lại để mặc định

Chọn Create task. Task sẽ được tạo và tự động chạy. Chúng ta có thể thấy trạng thái là Replication ongoing.

Đợi 5 đến 10 phút để CDC data ánh xạ RDS postgres database
Chọn CDC task để xem chi tiết, xem phần Table statistics:

Mở S3 console và xem CDC data được copied từ DMS



