

Doc AWS SDK 예제 GitHub 리포지토리에서 더 많은 SDK 예제를 사용할 수 있습니다. [AWS](https://github.com/awsdocs/aws-doc-sdk-examples) 

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# AWS SDKs AWS DMS 사용에 대한 코드 예제
<a name="database-migration-service_code_examples"></a>

다음 코드 예제에서는 AWS 소프트웨어 개발 키트(SDK)와 AWS Database Migration Service 함께를 사용하는 방법을 보여줍니다.

*작업*은 대규모 프로그램에서 발췌한 코드이며 컨텍스트에 맞춰 실행해야 합니다. 작업은 개별 서비스 함수를 직접 호출하는 방법을 보여주며, 관련 시나리오의 컨텍스트에 맞는 작업을 볼 수 있습니다.

**추가 리소스**
+  **[AWS DMS 개발자 안내서](https://docs.aws.amazon.com/dms/latest/userguide/Welcome.html)** -에 대한 자세한 정보입니다 AWS DMS.
+ **[AWS DMS API 참조](https://docs.aws.amazon.com/dms/latest/APIReference/Welcome.html)** - 사용 가능한 모든 AWS DMS 작업에 대한 세부 정보입니다.
+ **[AWS 개발자 센터](https://aws.amazon.com/developer/code-examples/?awsf.sdk-code-examples-product=product%23)** - 범주 또는 전체 텍스트 검색을 기준으로 필터링할 수 있는 코드 예제입니다.
+ **[AWS SDK 예제](https://github.com/awsdocs/aws-doc-sdk-examples)** - 기본 설정 언어로 된 전체 코드가 포함된 GitHub 리포지토리입니다. 코드 설정 및 실행을 위한 지침이 포함되어 있습니다.

**Contents**
+ [기본 사항](database-migration-service_code_examples_basics.md)
  + [작업](database-migration-service_code_examples_actions.md)
    + [`CreateReplicationTask`](database-migration-service_example_database-migration-service_CreateReplicationTask_section.md)

# AWS SDKs AWS DMS 사용에 대한 기본 예제
<a name="database-migration-service_code_examples_basics"></a>

다음 코드 예제에서는 AWS Database Migration Service SDKs에서의 기본 사항을 AWS 사용하는 방법을 보여줍니다.

**Contents**
+ [작업](database-migration-service_code_examples_actions.md)
  + [`CreateReplicationTask`](database-migration-service_example_database-migration-service_CreateReplicationTask_section.md)

# AWS SDKs AWS DMS 를 사용하기 위한 작업
<a name="database-migration-service_code_examples_actions"></a>

다음 코드 예제에서는 AWS SDKs를 사용하여 개별 AWS DMS 작업을 수행하는 방법을 보여줍니다. 각 예시에는 GitHub에 대한 링크가 포함되어 있습니다. 여기에서 코드 설정 및 실행에 대한 지침을 찾을 수 있습니다.

 다음 예제에는 가장 일반적으로 사용되는 작업만 포함되어 있습니다. 전체 목록은 [AWS Database Migration Service API 참조](https://docs.aws.amazon.com/dms/latest/APIReference/Welcome.html)를 참조하세요.

**Topics**
+ [`CreateReplicationTask`](database-migration-service_example_database-migration-service_CreateReplicationTask_section.md)

# CLI로 `CreateReplicationTask` 사용
<a name="database-migration-service_example_database-migration-service_CreateReplicationTask_section"></a>

다음 코드 예시는 `CreateReplicationTask`의 사용 방법을 보여 줍니다.

------
#### [ CLI ]

**AWS CLI**  
**복제 태스크 생성**  
다음 `create-replication-task` 예시에서는 복제 태스크를 생성합니다.  

```
aws dms create-replication-task \
    --replication-task-identifier movedata \
    --source-endpoint-arn arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA \
    --target-endpoint-arn arn:aws:dms:us-east-1:123456789012:endpoint:EOM4SFKCZEYHZBFGAGZT3QEC5U \
    --replication-instance-arn $RI_ARN \
    --migration-type full-load \
    --table-mappings file://table-mappings.json
```
`table-mappings.json`의 콘텐츠:  

```
{
    "rules": [
        {
            "rule-type": "selection",
            "rule-id": "1",
            "rule-name": "1",
            "object-locator": {
                "schema-name": "prodrep",
                "table-name": "%"
            },
            "rule-action": "include",
            "filters": []
        }
    ]
}
```
출력:  

```
{
    "ReplicationTask": {
        "ReplicationTaskIdentifier": "moveit2",
        "SourceEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA",
        "TargetEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:EOM4SFKCZEYHZBFGAGZT3QEC5U",
        "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE",
        "MigrationType": "full-load",
        "TableMappings": ...output omitted... ,
        "ReplicationTaskSettings": ...output omitted... ,
        "Status": "creating",
        "ReplicationTaskCreationDate": 1590524772.505,
        "ReplicationTaskArn": "arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII"
    }
}
```
자세한 내용은 *AWS Database Migration Service 사용 설명서*의 [AWS DMS 작업 작업을 참조하세요](https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.html).  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [CreateReplicationTask](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/dms/create-replication-task.html)를 참조하세요.

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**예제 1:이 예제에서는 CdcStartPosition 대신 CdcStartTime을 사용하는 새 AWS 데이터베이스 마이그레이션 서비스 복제 작업을 생성합니다. CdcStartPosition MigrationType은 'full-load-and-cdc'로 설정되어 있습니다. 즉, 대상 테이블이 비어 있어야 합니다. 새 작업에는 키가 Stage이고 키 값이 Test인 태그가 지정됩니다. 이 cmdlet에서 사용하는 값에 대한 자세한 내용은 AWS Database Migration Service 사용 설명서의 작업 생성(https://docs.aws.amazon.com/dms/latest/userguide/CHAP\$1Tasks.Creating.html)을 참조하세요.**  

```
New-DMSReplicationTask -ReplicationInstanceArn "arn:aws:dms:us-east-1:123456789012:rep:EXAMPLE66XFJUWATDJGBEXAMPLE"`
  -CdcStartTime "2019-08-08T12:12:12"`
  -CdcStopPosition "server_time:2019-08-09T12:12:12"`
  -MigrationType "full-load-and-cdc"`
  -ReplicationTaskIdentifier "task1"`
  -ReplicationTaskSetting ""`
  -SourceEndpointArn "arn:aws:dms:us-east-1:123456789012:endpoint:EXAMPLEW5UANC7Y3P4EEXAMPLE"`
  -TableMapping "file:////home/testuser/table-mappings.json"`
  -Tag @{"Key"="Stage";"Value"="Test"}`
  -TargetEndpointArn "arn:aws:dms:us-east-1:123456789012:endpoint:EXAMPLEJZASXWHTWCLNEXAMPLE"
```
+  API 세부 정보는 *AWS Tools for PowerShell Cmdlet 참조(V4)*의 [CreateReplicationTask](https://docs.aws.amazon.com/powershell/v4/reference)를 참조하세요.

**Tools for PowerShell V5**  
**예제 1:이 예제에서는 CdcStartPosition 대신 CdcStartTime을 사용하는 새 AWS 데이터베이스 마이그레이션 서비스 복제 작업을 생성합니다. CdcStartPosition MigrationType은 'full-load-and-cdc'로 설정되어 있습니다. 즉, 대상 테이블이 비어 있어야 합니다. 새 작업에는 키가 Stage이고 키 값이 Test인 태그가 지정됩니다. 이 cmdlet에서 사용하는 값에 대한 자세한 내용은 AWS Database Migration Service 사용 설명서의 작업 생성(https://docs.aws.amazon.com/dms/latest/userguide/CHAP\$1Tasks.Creating.html)을 참조하세요.**  

```
New-DMSReplicationTask -ReplicationInstanceArn "arn:aws:dms:us-east-1:123456789012:rep:EXAMPLE66XFJUWATDJGBEXAMPLE"`
  -CdcStartTime "2019-08-08T12:12:12"`
  -CdcStopPosition "server_time:2019-08-09T12:12:12"`
  -MigrationType "full-load-and-cdc"`
  -ReplicationTaskIdentifier "task1"`
  -ReplicationTaskSetting ""`
  -SourceEndpointArn "arn:aws:dms:us-east-1:123456789012:endpoint:EXAMPLEW5UANC7Y3P4EEXAMPLE"`
  -TableMapping "file:////home/testuser/table-mappings.json"`
  -Tag @{"Key"="Stage";"Value"="Test"}`
  -TargetEndpointArn "arn:aws:dms:us-east-1:123456789012:endpoint:EXAMPLEJZASXWHTWCLNEXAMPLE"
```
+  API 세부 정보는 *AWS Tools for PowerShell Cmdlet 참조(V5)*의 [CreateReplicationTask](https://docs.aws.amazon.com/powershell/v5/reference)를 참조하세요.

------