如何為 AWS DMS 端點新增或修改端點設定?
我想為 AWS Database Migration Service (AWS DMS) 端點新增或修改額外連線屬性。
簡短說明
端點設定 (先前稱為額外連線屬性) 定義 AWS DMS 任務要使用的其他端點專屬設定。例如,您可以使用端點設定來控制特定端點的逾時、時區與檔案大小設定。若要為您的 AWS DMS 端點新增或修改端點設定,請使用以下選項:
- AWS DMS 主控台
- AWS Command Line Interface (AWS CLI)
- AWS CloudFormation。
解決方法
**注意:**如果您在執行 AWS CLI 命令時收到錯誤,請參閱對 AWS CLI 錯誤進行疑難排解。此外,請確定您使用的是最新的 AWS CLI 版本。
使用 AWS DMS 主控台建立具有額外連線屬性的新端點
1. 開啟 AWS DMS 主控台並選擇您要建立端點的 AWS 區域。
2. 在導覽窗格中,選擇 Endpoints (端點)。
3. 選擇 Create endpoint (建立端點)。
4. 選擇 Endpoint type (端點類型),然後輸入 Endpoint configuration (端點組態) 詳細資訊。
5. 展開 Endpoint settings (端點設定) 區段。
6. 選擇 Add new setting (新增設定)。使用精靈或 JSON 編輯器提供端點的名稱和值。
範例:
{ "CsvRowDelimiter": "\\n", "CsvDelimiter": ",", "CompressionType": "GZIP", "DataFormat": "parquet", "EnableStatistics": true, "DatePartitionEnabled": false }
7. (選用) 選擇 Use endpoint connection attributes (使用端點連線屬性)。輸入您的額外連線屬性 (ECA)。請確保您以分號分隔每個不同欄位。
範例:
compressionType=GZIP;csvDelimiter=,;csvRowDelimiter=\n;datePartitionEnabled=false;
8. 展開 Test endpoint connection (測試端點連線) 區段。
9. 選擇您的 VPC 與 Replication instance (複寫執行個體)。
9. 選擇 Run test (執行測試)。
10. 選擇 Create endpoint (建立端點)。
使用 AWS DMS 主控台將端點設定 (或 ECA) 新增至現有端點
- 開啟 AWS DMS console (AWS DMS 主控台),然後選取端點所在的 AWS 區域。
- 在導覽窗格中,選擇 Endpoints (端點),然後選取您要修改的端點。
- 選擇 Actions (動作),然後選擇 Modify (修改)。
- 展開 Endpoint settings (端點設定) 區段,然後使用精靈或 JSON 編輯器輸入端點設定鍵值。
- 選擇 Save (儲存)。
- 再次選取該端點。
- 選擇 Actions (動作),然後選擇 Test connection (測試連線)。
- 選取您的 Replication instance (複寫執行個體),然後選擇 Run test (執行測試)。
使用 AWS CLI 建立具有自訂端點設定的新端點
1. 安裝並設定 AWS CLI。選取您要建立端點的 AWS 區域。
2. 執行 create-endpoint 命令:
aws dms create-endpoint --endpoint-identifier <value> --endpoint-type <value> --engine-name <value> --s3-settings ServiceAccessRoleArn=arn:aws:iam::1111111111111:role/<role-name>,BucketName=<bucket-name>,CompressionType=GZIP,MaxFileSize=32000
3. 使用複寫執行個體測試新端點的連線能力:
aws dms test-connection--replication-instance-arn <value> --endpoint-arn <value>
使用 AWS CLI 將端點設定新增至現有端點
1. 安裝並設定 AWS CLI。選取您要建立端點的 AWS 區域。
2. 執行 modify-endpoint 命令:
aws dms modify-endpoint--endpoint-arn <value> --s3-settings Rfc4180=true,AddColumnName=true,CdcInsertsOnly=true,MaxFileSize=64000
3. 使用複寫執行個體測試已修改端點的連線能力:
aws dms test-connection--replication-instance-arn <value> --endpoint-arn <value>
使用 AWS CloudFormation 建立具有自訂端點設定的新端點
1. 開啟 CloudFormation 主控台。選取您要建立端點的 AWS 區域。
2. 選擇 Create stack (建立堆疊)
3. 選取 Template is ready (範本已就緒)。
4. 選擇 Upload a template file (上傳範本檔案)。
5. 建立 YAML 或 JSON CloudFormation 檔案。
範例:
AWSTemplateFormatVersion: 2010-09-09 Description: "S3 target Endpoint" Resources: S3TargetEndpoint: Type: AWS::DMS::Endpoint Properties: EndpointIdentifier: s3-Target-endpoint EndpointType: target EngineName: s3 S3Settings: ServiceAccessRoleArn: arn:aws:iam::<AWS-account-number>:role/<role-name> BucketName: <bucket-name> AddColumnName: true CdcInsertsOnly: true MaxFileSize: 32000
6. 選擇 Next (下一步)。
7. 為堆疊輸入名稱。
8. 指派具有建立 DMS 資源所需權限的 IAM 角色
9. 選擇 Next (下一步)。
10. 選擇 Submit (提交)。
使用 AWS CloudFormation 將端點設定新增至現有端點
1. 開啟 CloudFormation 主控台。選取您要建立端點的 AWS 區域。
2. 選取現有堆疊,然後選擇 Update (更新)。
3. 在 Update stack (更新堆疊) 頁面上,選擇 Replace current template (替換目前範本)。
4. 在 Specify template (指定範本) 下,選擇 Upload a template file (上傳範本檔案)。使用此範例範本:
AWSTemplateFormatVersion: 2010-09-09 Description: "Endpoint S3 target" Resources: BasicS3TargetEndpoint: Type: AWS::DMS::Endpoint Properties: EndpointIdentifier: s3-Target-endpoint EndpointType: target EngineName: s3 S3Settings: ServiceAccessRoleArn: arn:aws:iam::<AWS-account-number>:role/<role-name> BucketName: <bucket-name> AddColumnName: true CdcInsertsAndUpdates: true MaxFileSize: 64000
5. 選擇 Next (下一步)。
6. 在 Specify stack details (指定堆疊詳細資訊) 頁面上,選擇 Next (下一步)。
7. (選用) 在 Configure stack options (設定堆疊選項) 頁面上,在 Tags (標籤) 下新增標籤。在 Permissions (權限) 下,選取您要代表您進行更新的 IAM 角色。然後,選擇 Next (下一步)。
8. 選擇 Submit (提交)。
舊版額外連線屬性
您可以使用 --extra-connection-attributes 選項來建立與修改端點。使用額外連線屬性時,您無需明確指定端點類型。
範例:
aws dms create-endpoint --endpoint-identifier <value> --endpoint-type <value> --engine-name <value> --username <value> --password <value> --server-name <value> --port <value> --extra-connection-attributes encryptionMode=SSE_KMS;maxFileSize=512 aws dms modify-endpoint --endpoint-arn <value> --extra-connection-attributes encryptionMode=SSE_KMS;maxFileSize=512
相關資訊
- 語言
- 中文 (繁體)
