DMS Replication Instance 는 Source Database의 Data를 읽어서 Target Database(S3포함)로 이관합니다.
- Database Migration Service (DMS) console 을 새 창(새탭)으로 엽니다.
- Create Replication Instance Click
- 다음의 정보대로 입력 후 Create Click, 인스턴스 생성까지 5분정도 소요
Name : DMSReplication
Description : Replication server for Database Migration
Instance Class : dms.c5.large
Engine version : 기본 값 사용
Allocated storage (GB) : 50
VPC : vpc-xxxxxxxxxxxx - SQL-S3-Migration-DmsVpc
Multi-AZ : No
Publicly accessible : No
나머지 기본 값 사용
- Replication Instance 생성 확인 후, 메뉴 좌측 "Endpoints" Click
- Create Endpoints Click
-
다음의 정보대로 Source Endpoint를 구성하고
Run Test 를 Click하여 RI(Replication Instance) 와 접속 여부를 확인
접속이 successful이 되면 Create endpoint Click
Endpoint Type : Source endpoint
Endpoint Identifier : sqlserver-source
Source Engine : Microsoft SQL Server
Access to endpoint database : Provide access information manually
Server Name : < SourceEC2PrivateDns > (CloudFormation Output에서 확인했던 값 사용)
Port : 1433
SSL Mode : none
User Name : awssct
Password : Password1
Database Name : dms_sample
Test endpoint connection(optional)
Test endpoint connection -> VPC < VPC ID from Environment Setup Step >
Replication Instance : dmsreplication
- Replication Instance 생성 확인 후, 메뉴 좌측 "Endpoints" Click
- Create Endpoints Click
-
다음의 정보대로 Target Endpoint를 구성하고
Run Test 를 Click하여 RI(Replication Instance) 와 접속 여부를 확인
접속이 successful이 되면 Create endpoint Click
Endpoint Type : Target endpoint
Endpoint Identifier : S3-target
Source Engine : Amazon S3
Service access role ARN : < ARN of the DMS-LAB-Role > (앞의 IAM에서 복사한 IAM Role ARN사용)
Bucket name : < Name of Your S3 Bucket > (앞서 생성한 Bucket 이름 사용)
Bucket folder : dmstargetfolder (Bucket아래에 생성했던 Folder 이름 사용)
# Endpoint settings
Wizard 선택
"Add new setting" Click
AddColumnName을 선택 하고 true 입력 (RDB Table의 Column이름을 가져오기 위한 설정)
- Replication Instance 생성 확인 후, 메뉴 좌측 "Database Migration tasks" Click
- Create Task Click
- 다음의 정보대로 Task Configuration를 구성하고 Create Task Click
Task identifier : SampleMigrationTask
Replication instance : DMSReplication
Source database endpoint : sqlserver-source
Target database endpoint : S3-target
Migration type : Migrate existing data
# Task settings
CDC stop mode : Don’t use custom CDC stop mode
Target table preparation mode : Do nothing
Stop task after full load completes : Don’t stop
Include LOB columns in replication : Limited LOB mode
Max LOB size (KB) : 32
Enable validation : Unchecked
Enable CloudWatch logs : Checked
# Table mappings
Editing mode : JSON editor 선택 후 아래 JSON으로 변경
{
"rules": [
{
"rule-type": "selection",
"rule-id": "161752734",
"rule-name": "161752734",
"object-locator": {
"schema-name": "dbo",
"table-name": "%"
},
"rule-action": "include",
"filters": []
}
]
}
- Task samplemigrationtask 가 실행 (Starting)으로 바뀌면 Click하여 작업 상황을 모니터링
- Table statistics 를 Click하여 Migration 상황을 확인합니다.
- Open the Amazon S3 console 을 새 창(새탭)으로 엽니다.
-
아까 생성한 Bucket으로 이동하고, dmstargetfolder 를 Click 합니다.
dbo folder 아래에 다음과 같이 Data들이 이관됨을 확인
- sport_type folder로 이동하여 LOAD00000001.csv 를 다운로드 하여 열어봅니다.
- sporting_event 파일도 확인 합니다.