问题描述
使用以下 python boto3 脚本创建 AWS DMS 任务并启动复制任务,但出现以下错误:
错误:
botocore.errorfactory.InvalidResourceStateFault: An error occurred (InvalidResourceStateFault) when calling the StartReplicationTask operation: Replication Task cannot be started,invalid state
Python 脚本:
#!/usr/bin/python
import boto3
client_dms = boto3.client('dms')
#Create a replication DMS task
response = client_dms.create_replication_task(
ReplicationTaskIdentifier='test-new1',ResourceIdentifier='test-new',ReplicationInstanceArn='arn:aws:dms:us-east-1:xxxxxxxxxx:rep:test1',SourceEndpointArn='arn:aws:dms:us-east-1:xxxxxxxxxx:endpoint:source',TargetEndpointArn='arn:aws:dms:us-east-1:xxxxxxxxxx:endpoint:target',MigrationType='full-load',TableMappings='{\n \"TableMappings\": [\n {\n \"Type\": \"Include\",\n \"SourceSchema\": \"test\",\n \"SourceTable\": \"table_name\"\n}\n ]\n}\n\n'
)
#Start the task from DMS
response = client_dms.start_replication_task(
ReplicationTaskArn='arn:aws:dms:us-east-1:xxxxxxxxxx:task:test-new',StartReplicationTaskType='start-replication'
)