本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
示例:以编程方式将 S3 与客户档案集成
使用客户档案 PutIntegrationAPI,您可以以编程方式为 S3、Salesforce、Marketo 等创建集成。
在本主题中,我们展示如何创建 S3 集成,同步间隔为 15 分钟,这是目前支持的最小值。
步骤 1:创建一个
使用以下内容创建一个 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
:在纪元时段设置为当前DateTime
+ 5 分钟。 -
FirstExecutionFrom
:转到 S3,查看文件日期,然后使用最早日期之前的日期。 -
Tasks
:定义TaskType
。在该Sourcefields
字段中,您必须提供该数组中 CSV 中的所有列。然后,对于该数组中的每个项目,您需要指定ConnectorOperator
。此示例适用于包含两列的 CSV 文档:colA
和colB
。
步骤 2:调用PutIntegration API
使用您的值创建并自定义 JSON 文件后,调用 PutIntegrationAPI,如以下示例所示:
aws customer-profiles put-integration --cli-input-json file:///
put_integration_s3_cli.json
--regionus-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 步:调用亚马逊AppFlowStartFlow API
使用流程 URI 调用亚马逊AppFlow StartFlowAPI。例如:
aws appflow start-flow —flow-name
uri
--regionus-west-2