- 创建源群集的快照,确保在创建快照时已勾选“包括所有跨帐户授予”的选项。
aws redshift create-cluster-snapshot --snapshot-identifier source-cluster-snapshot --cluster-identifier source-cluster --account-with-restore-access source-account --include-public --include-shared --include-encrypted
- 将快照复制到目标帐户。
aws redshift copy-cluster-snapshot --source-snapshot-identifier arn:aws:redshift:us-east-1:source-account:snapshot:source-cluster-snapshot --source-region us-east-1 --target-snapshot-identifier target-cluster-snapshot --target-region us-east-1
- 创建恢复群集,并指定要恢复的快照。
aws redshift restore-from-cluster-snapshot --cluster-identifier target-cluster --snapshot-identifier arn:aws:redshift:us-east-1:target-account:snapshot:target-cluster-snapshot
- 将表复制到恢复的群集中。
aws dms create-endpoint --endpoint-identifier redshift-target-endpoint --endpoint-type target --engine-name redshift --redshift-settings ServerName=target-cluster.123456789012.us-east-1.redshift.amazonaws.com,Port=5439,DatabaseName=dbname,Username=masteruser,Password=your_password
aws dms create-replication-task --replication-task-identifier redshift-target-task --source-endpoint-arn source-endpoint-arn --target-endpoint-arn redshift-target-endpoint --replication-instance-arn replication-instance-arn --migration-type full-load --table-mappings file://table-mapping.json
其中table-mapping.json文件包含要复制的表的映射信息。