

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

# 예: 프로그래밍 방식으로 S3를 Amazon Connect Customer Profiles와 통합
<a name="customerprofiles-s3-integration"></a>

Customer Profiles [PutIntegration](https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_PutIntegration.html) API를 사용하여 S3, Salesforce, Marketo 등에 대한 통합을 프로그래밍 방식으로 생성할 수 있습니다.

이 주제에서는 현재 지원되는 최소값인 15분의 동기화 간격으로 S3 통합을 생성하는 방법을 보여 줍니다.

## 1단계: JSON 파일 생성
<a name="step1-cpintegration"></a>

다음 내용의 JSON 파일을 생성합니다.

```
{
    "DomainName": "{{your-domain}}",
    "ObjectTypeName": "{{your-object-name}}", 
    "FlowDefinition": {
        "FlowName": "{{your-flow-name}}",
        "KmsArn": "{{the key ARN is the same as your domain's key}}",
        "Description": "Created by Customer Profiles",
        "TriggerConfig": {
            "TriggerType": "Scheduled",
            "TriggerProperties": {
                "Scheduled": {
                    "ScheduleExpression": "rate(15minutes)",
                    "DataPullMode": "Incremental",
                    "ScheduleStartTime": {{1634244800.435}},
                    "FirstExecutionFrom": {{1594166400}}
                }
            }
        },
        "SourceFlowConfig": {
            "ConnectorType":"S3",
            "SourceConnectorProperties": {
                "S3": {
                    "BucketName": "{{your-bucket}}",
                    "BucketPrefix": "{{your-prefix}}"
                }
            }
        },
        "Tasks": [
            {"TaskType":"{{Filter}}","SourceFields":["{{colA}}","{{colB}}"],"ConnectorOperator":{"{{S3}}":"{{PROJECTION}}"}},
            {"ConnectorOperator":{"{{S3}}":"{{NO_OP}}"},"DestinationField":"{{colA}}","TaskProperties":{},"SourceFields":["{{colA}}"],"TaskType":"{{Map}}"},
            {"ConnectorOperator":{"{{S3}}":"{{NO_OP}}"},"DestinationField":"{{colB}}","TaskProperties":{},"SourceFields":["{{colB}}"],"TaskType":"{{Map}}"}
        ]
    }
}
```

고유한 값으로 JSON을 사용자 지정하려면 다음 지침을 따르세요.
+ `FlowName`: [a-zA-Z0-9][\\w\!@\#.-]\+ 문자열일 수 있습니다.
+ `ScheduleStartTime`: Epoch 시간 기준 현재 `DateTime` \+ 5분으로 설정합니다.
+ `FirstExecutionFrom`: S3로 이동하여 파일 날짜를 확인하고 가장 오래된 날짜 이전 날짜를 사용합니다.
+ `Tasks`: `TaskType`을 정의합니다. `Sourcefields` 필드에 해당 배열의 CSV에 있는 모든 열을 입력해야 합니다. 그런 다음 해당 배열의 각 항목에 대해 `ConnectorOperator`를 지정해야 합니다. 이 예제는 두 개의 열(`colA` 및 `colB`)이 있는 CSV 문서를 위한 것입니다.

## 2단계: PutIntegration API 호출
<a name="step2-cpintegration"></a>

값을 사용하여 JSON 파일을 만들고 사용자 지정한 후에는 다음 예와 같이 [PutIntegration](https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_PutIntegration.html) API를 호출합니다.

```
aws customer-profiles put-integration --cli-input-json file:///{{put_integration_s3_cli.json}} --region {{us-west-2}}                    
```

`PutIntegration`의 응답은 흐름 URI를 반환합니다. 예제:

```
{
    "DomainName": "testDomain",
    "Uri": "arn:aws:appflow:us-west-2:9999999999999:flow/Customer_Profiles_testDomain_S3_Salesforce-Account_1634244122247",
    "ObjectTypeName": "your objec type",
    "CreatedAt": "2021-10-14T13:51:57.748000-07:00",
    "LastUpdatedAt": "2021-10-14T13:51:57.748000-07:00",
    "Tags": {}
}
```

## 3단계: Amazon AppFlow StartFlow API 호출
<a name="step3-cpintegration"></a>

흐름 URI를 사용하여 Amazon AppFlow [StartFlow](https://docs.aws.amazon.com/appflow/1.0/APIReference/API_StartFlow.html) API를 호출할 수 있습니다. 예제:

```
aws appflow start-flow —flow-name {{uri}} --region {{us-west-2}}
```