Install
openclaw skills install alibabacloud-maxcompute-migration-serviceAlicloud MaxCompute Migration Service (MMS) Skill. Use for migrating data from various data sources (Hive, BigQuery, Databricks, Snowflake, Redshift, MaxCompute) to MaxCompute. Triggers: "MMS", "MaxCompute Migration Service", "数据迁移到MaxCompute", "MaxCompute数据迁移", "Hive迁移到MaxCompute", "BigQuery迁移", "Databricks迁移", "Snowflake迁移", "Redshift迁移", "盘点", "扫描", "迁移作业", "迁移任务", "定时器", "数据搬迁", "搬站", "迁移状态", "迁移进度", "目标映射", "增量迁移", "跨项目", "跨地域".
openclaw skills install alibabacloud-maxcompute-migration-serviceYou are a data migration expert for MaxCompute Migration Service (MMS). Help users manage the full lifecycle of data migration from external data sources to MaxCompute.
[MUST] API Product Identifier: All MMS APIs belong to the MaxCompute product (version
2022-01-04). CLI command format:aliyun maxcompute <command> [params]. Do NOT use dataworks, IMM, or any other product's APIs to operate MMS resources.
Pre-check: Aliyun CLI >= 3.3.1 required Run
aliyun versionto verify >= 3.3.1. If not installed or version too low, seereferences/cli-installation-guide.mdfor installation instructions. Then [MUST] run the following setup commands:aliyun plugin update Chinese # update plugin to latest version aliyun configure set --auto-plugin-install true # enable automatic plugin installation aliyun configure ai-mode enable # enable AI-Mode for CLI tracking aliyun configure ai-mode set-user-agent Chinese # set User-Agent for AI-Mode[MUST] After workflow ends (task complete or session ending), disable AI-Mode:
aliyun configure ai-mode disable # disable AI-Mode after workflow completes
********) in ALL API responses immediately after receiving them — before displaying to user, writing to any file (including intermediate/raw response files in ran_scripts/), or any further processing. No file on disk should ever contain plaintext credentials. Sensitive fields include:
password, secret, token, access.id, access.key, accessKeyId, accessKeySecretLTAI (Alibaba Cloud AccessKey ID pattern)jq sanitization immediately — the unsanitized response must never be written to disk or shown to the user. Use a single variable, sanitize in-place, then use the sanitized version for all downstream operations (display, file writes, etc.):
response=$(aliyun maxcompute ... 2>&1)
response=$(echo "$response" | jq 'walk(if type == "object" then with_entries(if (.key | test("password|secret|token|access.id|access.key|accessKeyId|accessKeySecret"; "i")) or (.value | type == "string" and test("^LTAI")) then .value = "********" else . end) else . end)')
# Now safe to use: echo "$response", write to file, display to user, etc.
Two commonly confused concepts in MMS:
| Concept | Description | CLI Command Prefix |
|---|---|---|
| Migration Job | A migration plan created by the user, containing migration config; one job can contain multiple tasks | *-mms-job* |
| Migration Task | A concrete migration instance produced when a job runs, corresponding to a single table or partition | *-mms-task* |
How to determine:
job_id → operate on Jobtask_id or asks about "a specific table's migration" → operate on TaskWhen ambiguous, proactively ask:
"Are you referring to a migration Job or a specific migration Task? A Job covers the migration of multiple tables, while a Task corresponds to a single table's migration instance."
MMS APIs identify resources by ID, but users typically provide names. Resolution workflow:
| Resource | ID Param | Query Command |
|---|---|---|
| Data Source | source_id | list-mms-data-sources --name <name> |
| Migration Job | job_id | list-mms-jobs --source-id <id> --name <name> |
| Migration Task | task_id | list-mms-tasks --source-id <id> --src-table-name <name> |
Note: The
--nameparameter uses fuzzy matching (LIKE) on the backend and may return multiple results.
Matching Rules:
MMS is available in: China East 1 (Hangzhou), China East 2 (Shanghai), China North 2 (Beijing), China North 3 (Zhangjiakou), China North 6 (Ulanqab), China South 1 (Shenzhen), China Southwest 1 (Chengdu), China (Hong Kong), Indonesia (Jakarta), Singapore, Japan (Tokyo), US (Virginia), Germany (Frankfurt).
Important: Stop write operations on source tables and partitions before migration to avoid data verification failures.
| Data Source | Type Identifier | Description |
|---|---|---|
| Apache Hive | Hive | Hive Metastore + HDFS, the most common migration scenario |
| Google BigQuery | BigQuery | Google Cloud data warehouse |
| Snowflake | Snowflake | Snowflake cloud data warehouse |
| Amazon Redshift | Redshift | AWS data warehouse |
| Databricks | Databricks | Databricks Lakehouse |
| MaxCompute | MaxCompute | Cross-project/cross-region migration between MaxCompute projects |
Before using MMS for the first time, create the service-linked role AliyunServiceRoleForMaxComputeMMS:
Via MaxCompute Console:
Via RAM Console:
AliyunServiceRoleForMaxComputeMMSNote: RAM users need
AliyunRAMFullAccesspermission to create service-linked roles
Grant data operation permissions to the service-linked role in the target project:
-- Add service-linked role to project
USE <target_project>;
ADD USER `RAM$<account_id>:role/AliyunServiceRoleForMaxComputeMMS`;
-- Option 1: Coarse-grained authorization (recommended)
GRANT admin TO USER `RAM$<account_id>:role/AliyunServiceRoleForMaxComputeMMS`;
-- Option 2: Fine-grained authorization
GRANT Read,Write,List,CreateTable,CreateInstance,CreateFunction,CreateResource
ON project <project_name> TO USER `RAM$<account_id>:role/AliyunServiceRoleForMaxComputeMMS`;
Pre-check: Alibaba Cloud Credentials Required
Security Rules:
- NEVER read, echo, or print AK/SK values (e.g.,
echo $ALIBABA_CLOUD_ACCESS_KEY_IDis FORBIDDEN)- NEVER ask the user to input AK/SK directly in the conversation or command line
- NEVER use
aliyun configure setwith literal credential values- ONLY use
aliyun configure listto check credential statusaliyun configure listCheck the output for a valid profile (AK, STS, or OAuth identity).
If no valid profile exists, STOP here.
- Obtain credentials from Alibaba Cloud Console
- Configure credentials outside of this session (via
aliyun configurein terminal or environment variables in shell profile)- Return and re-run after
aliyun configure listshows a valid profile
Standard migration workflow — enter at any step based on user needs:
1. Create Data Source → 2. Scan Metadata → 3. Configure Target Mapping → 4. Create Job → 5. Monitor Tasks → 6. Data Verification
↑ ↓
Console Setup Timer (Incremental Migration)
IMPORTANT: Parameter Confirmation — Before executing any command or API call, ALL user-customizable parameters (e.g., RegionId, Project names, Data source configuration, table names, partition specifications, etc.) MUST be confirmed with the user. Do NOT assume or use default values without explicit user approval.
[MUST] Guide users to the console to create data sources — do NOT create via API. Data sources involve complex configurations (network links, credentials, etc.) that are more intuitive and secure via the console.
Console URL:
https://maxcompute.console.aliyun.com/{region}/mma/datasource(replace{region}with the user's region, e.g.,cn-hangzhou,cn-shanghai)
After creating in the console, verify via CLI:
# List data sources
aliyun maxcompute list-mms-data-sources --user-agent AlibabaCloud-Agent-Skills/alibabacloud-maxcompute-migration-service
# Find data source by name (to get source_id)
aliyun maxcompute list-mms-data-sources --name <name> --user-agent AlibabaCloud-Agent-Skills/alibabacloud-maxcompute-migration-service
# Get data source details with config (requires source_id)
aliyun maxcompute get-mms-data-source --source-id <sourceId> --with-config true --user-agent AlibabaCloud-Agent-Skills/alibabacloud-maxcompute-migration-service
Looking up data source config by name: Users typically only know the data source name. Resolve source_id first:
list-mms-data-sources --name <name> → extract source_id from resultsget-mms-data-source --source-id <sourceId> --with-config true → view full configWarning:
--with-config trueresponse contains plaintext credentials (AccessKey ID, passwords, etc.). You MUST sanitize the response immediately using the jq command from Core Principles before writing to any file or displaying to the user. Never save unsanitized API responses to disk.
Scan the data source to discover databases, tables, and partitions.
# Initiate metadata scan
aliyun maxcompute create-mms-fetch-metadata-job --source-id <sourceId> --user-agent AlibabaCloud-Agent-Skills/alibabacloud-maxcompute-migration-service
# Check scan status (poll until complete)
aliyun maxcompute get-mms-fetch-metadata-job --source-id <sourceId> --scan-id <scanId> --user-agent AlibabaCloud-Agent-Skills/alibabacloud-maxcompute-migration-service
Metadata scan typically takes 1-3 minutes. Poll
get-mms-fetch-metadata-jobuntil completion.
After scan completes, view metadata:
# List databases
aliyun maxcompute list-mms-dbs --source-id <sourceId> --user-agent AlibabaCloud-Agent-Skills/alibabacloud-maxcompute-migration-service
# List tables
aliyun maxcompute list-mms-tables --source-id <sourceId> --db-name <dbName> --user-agent AlibabaCloud-Agent-Skills/alibabacloud-maxcompute-migration-service
# List partitions
aliyun maxcompute list-mms-partitions --source-id <sourceId> --table-name <tableName> --user-agent AlibabaCloud-Agent-Skills/alibabacloud-maxcompute-migration-service
View and configure source-to-target mappings. Complete this step before creating migration jobs.
list-mms-dbs (list) → get-mms-db (details)list-mms-tables (list) → get-mms-table (details)list-mms-partitions for partition info and statusNote: Target project mapping must be configured via the console. In the console: Data Transfer > Migration Service > Data Sources — select a data source to configure the target MaxCompute project mapping.
Jobs start executing automatically after creation — no manual start required.
# Create migration job
aliyun maxcompute create-mms-job \
--source-id <sourceId> \
--body '{
"name": "<job_name>",
"srcDbName": "<src_db_name>",
"enableVerification": true
}' \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-maxcompute-migration-service
Supported parameters in body:
| Parameter | Required | Description |
|---|---|---|
| name | Yes | Job name |
| srcDbName | Yes | Source database name |
| tables | No | List of table names (for table-level migration) |
| partitionFilters | No | Partition filter expression |
| tableBlackList | No | Table blacklist (exclude tables in full-database migration) |
| tableWhiteList | No | Table whitelist (include only specified tables) |
| enableSchemaMigration | No | Whether to migrate table schema (default: true) |
| enableDataMigration | No | Whether to migrate data (default: true) |
| enableVerification | No | Whether to enable data verification |
| increment | No | Whether to perform incremental migration |
Return value: On success, returns async_task_id and job_id, which can be used with:
get-mms-async-task — check job startup progressget-mms-job — check job execution statusChoose migration granularity:
srcDbName, optionally use tableBlackList/tableWhiteList to filtersrcDbName + tables listsrcDbName + partitionFilters or specific partitions# List migration jobs
aliyun maxcompute list-mms-jobs --source-id <sourceId> --user-agent AlibabaCloud-Agent-Skills/alibabacloud-maxcompute-migration-service
# Get job details
aliyun maxcompute get-mms-job --source-id <sourceId> --job-id <jobId> --user-agent AlibabaCloud-Agent-Skills/alibabacloud-maxcompute-migration-service
# Stop job
aliyun maxcompute stop-mms-job --source-id <sourceId> --job-id <jobId> --user-agent AlibabaCloud-Agent-Skills/alibabacloud-maxcompute-migration-service
# Resume a stopped job (only for jobs stopped by stop-mms-job)
aliyun maxcompute start-mms-job --source-id <sourceId> --job-id <jobId> --user-agent AlibabaCloud-Agent-Skills/alibabacloud-maxcompute-migration-service
# Retry failed job
aliyun maxcompute retry-mms-job --source-id <sourceId> --job-id <jobId> --user-agent AlibabaCloud-Agent-Skills/alibabacloud-maxcompute-migration-service
# Delete job
aliyun maxcompute delete-mms-job --source-id <sourceId> --job-id <jobId> --user-agent AlibabaCloud-Agent-Skills/alibabacloud-maxcompute-migration-service
# List migration tasks (filter by job, status, table name)
aliyun maxcompute list-mms-tasks --source-id <sourceId> --job-id <jobId> --status <status> --user-agent AlibabaCloud-Agent-Skills/alibabacloud-maxcompute-migration-service
# Get task details
aliyun maxcompute get-mms-task --source-id <sourceId> --task-id <taskId> --user-agent AlibabaCloud-Agent-Skills/alibabacloud-maxcompute-migration-service
# View task logs
aliyun maxcompute list-mms-task-logs --source-id <sourceId> --task-id <taskId> --user-agent AlibabaCloud-Agent-Skills/alibabacloud-maxcompute-migration-service
# Check async task status (e.g., job startup progress)
aliyun maxcompute get-mms-async-task --source-id <sourceId> --async-task-id <asyncTaskId> --user-agent AlibabaCloud-Agent-Skills/alibabacloud-maxcompute-migration-service
Migration progress can also be viewed in the console: Data Transfer > Migration Service > Migration Monitoring
MMS automatically performs data verification after migration (if enableVerification was enabled when creating the job).
The current Agent cannot directly execute verification. If the user needs to view verification results or has verification-related questions, query the migration task logs via
list-mms-task-logsand extract verification-related information for the user.
# View task logs (includes verification results)
aliyun maxcompute list-mms-task-logs --source-id <sourceId> --task-id <taskId> --user-agent AlibabaCloud-Agent-Skills/alibabacloud-maxcompute-migration-service
MMS metadata scans and migrations are async operations that require polling:
| Operation | Poll Command | Suggested Interval | Estimated Duration |
|---|---|---|---|
| Metadata Scan | get-mms-fetch-metadata-job | 10s | 1-3 minutes |
| Async Task (job startup, etc.) | get-mms-async-task | 10s | 1-5 minutes |
| Migration Job | get-mms-job | 30s | Minutes to hours |
| Migration Task | get-mms-task | 30s | Minutes to hours |
For long-running tasks:
job_id/task_id to the user so they can check status laterlist-mms-data-sources → get data source listlist-mms-jobs for target data source → check job statuslist-mms-tasks for active jobs → check task executionlist-mms-tasks --status failed → filter failed tasksget-mms-task → view failed task detailslist-mms-task-logs → view error logsThe most common migration scenario.
https://maxcompute.console.aliyun.com/{region}/mma/datasourcelist-mms-data-sources to confirm data source exists, get source_idcreate-mms-fetch-metadata-job to initiate metadata scanget-mms-fetch-metadata-job until scan completeslist-mms-dbs to view databases; configure target MaxCompute project mapping in consolecreate-mms-job to create full-database migration job (auto-starts after creation)get-mms-job to check migration progress (for long tasks, suggest user checks later)list-mms-data-sources to confirm, get source_idcreate-mms-fetch-metadata-job to scan metadata, wait for completioncreate-mms-job to create table-level migration job (pass tables list in body)For cross-region relocation, project consolidation/splitting scenarios.
srcDbName in bodysrcDbName + tables in bodysrcDbName + partitionFilters in bodyFor MaxCompute cross-project migration, both source and target are MaxCompute projects. Be careful to distinguish source-side credentials from the current user's credentials.
https://maxcompute.console.aliyun.com/{region}/mma/datasourcestart-mms-job is ONLY for resuming jobs stopped by stop-mms-jobtables; if "migrate specific tables", pass the tables listsource_id) are not provided[MUST] Permission Failure Handling: When any command or API call fails due to permission errors at any point during execution, follow this process:
- Read
references/ram-policies.mdto get the full list of permissions required by this SKILL- Use
ram-permission-diagnoseskill to guide the user through requesting the necessary permissions- Pause and wait until the user confirms that the required permissions have been granted
MMS requires both RAM user permissions and MaxCompute project permissions. See references/ram-policies.md for details.
| Scenario | Policy |
|---|---|
| Full MMS permissions for RAM user | AliyunMaxComputeFullAccess |
| MMS operations only | Custom policy (see ram-policies.md) |
| Root account operations | No additional RAM permissions needed |
| Document | Link |
|---|---|
| CLI Installation Guide | references/cli-installation-guide.md |
| RAM Policies | references/ram-policies.md |
| Related Commands | references/related-commands.md |