DMS Schema Conversion
Overview
This skill handles the full DMS Schema Conversion lifecycle — from first-time setup to running conversions on an existing project.
The AWS MCP server is recommended for streamlined execution, audit logging, and observability. When the MCP server is not available, all operations can be performed via AWS CLI directly.
Key documentation:
Global constraint: You MUST fetch and read any linked documentation before acting on it — do NOT rely on memory for any referenced material (selection rules, transformation rules, troubleshooting guides, network configuration, etc.). Documentation contains vendor-specific details that change between engines and API versions.
Guardrail — where this skill's own files live (MCP vs local install)
This skill can be loaded two ways, and they resolve the skill's own bundled files from different places. Determine how the skill was loaded before reading a reference:
- Loaded through the AWS MCP
retrieve_skill tool: The skill is not installed on the local filesystem. You MUST fetch each reference via retrieve_skill with the file parameter (e.g. file="references/setup-wizard.md"). Do NOT file_read these paths locally — they do not exist on disk.
- Installed locally (e.g.
.kiro/skills/dms-schema-conversion/ or ~/.claude/skills/dms-schema-conversion/): Read files from the local skill directory using relative paths.
This distinction applies only to the skill's own packaged files. User data and session artifacts are always read from and written to the user's working directory. Never fetch or write customer data through retrieve_skill.
Verify Dependencies
Before starting, check that AWS CLI commands can be executed.
Constraints:
- You MUST verify that AWS CLI commands can be run (via MCP server tools or directly via shell)
- You MUST inform the customer if no execution method is available and ask whether to proceed
- You MUST ask the customer which AWS region to use — do NOT attempt to infer it from the STS response (it does not contain a region field). If the customer is unsure, suggest checking the
AWS_DEFAULT_REGION environment variable or the --region flag they are using.
Project Selection
Check for existing migration projects:
aws dms describe-migration-projects
- If exactly one project exists → ask the customer: "Found migration project
<name>. Would you like to use it, or create a new one?" If they confirm, store migration_project_identifier and proceed to Actions Menu. If they want a new one, run the setup wizard.
- If multiple projects exist → list them and ask the customer to pick one, or offer to create a new project. Store
migration_project_identifier, proceed to Actions Menu.
- If no projects exist → ask: "No migration projects found. Would you like to create one?" If yes, load setup-wizard.md and run the full setup wizard from Phase 1. After wizard completes, run Auto Import, then proceed to Actions Menu.
Auto Import
This section runs only after the setup wizard creates a new project. Do NOT run for existing projects.
Build selection rules to import all schemas from the source server. For server-name, use the data provider identifier (the short ID from the ARN, e.g., JIFET2LUZJEJZPDYSOSGANOA2M) or the literal ServerName value from the data provider settings (e.g., "offline" for offline sources). For SQL Server, you MUST include database-name in the object locator. See Selection rules in DMS Schema Conversion for JSON format.
Run start-metadata-model-import with --origin SOURCE --refresh and the selection rules from step 1. Extract RequestIdentifier from the response.
Wait for import completion using the DMS waiter:
aws dms wait metadata-model-imported \
--migration-project-identifier <migration_project_identifier> \
--filter 'Name=schema-conversion-operation-id,Values=<RequestIdentifier>'
If the waiter fails or is unavailable, fall back to polling describe-metadata-model-imports every 30 seconds with --filter Name=request-id,Values=<RequestIdentifier>. Terminal statuses: SUCCESS (proceed) or FAILED (check error via the Error field in the response).
Show discovered schemas: On success, call describe-metadata-model-children with --origin SOURCE at the root level to list the imported schemas/databases. Present the discovered names to the customer so they can confirm the correct database connection was established:
"Import complete. I found the following schemas/databases: <list>. Does this look correct?"
Proceed to Actions Menu.
Actions Menu
Present the actions menu using a structured selection tool (e.g., AskUserQuestion) if available — this gives the customer a clickable/selectable list.
For SQL Server → PostgreSQL/Aurora PostgreSQL projects (present as a single-select question "What would you like to do?"):
- Convert database — convert schema objects to the target engine (also produces an conversion assessment report)
- Assess database — run a compatibility assessment (also produces an conversion assessment report)
- Convert statement — convert a single SQL statement
- Clean up — delete migration project and related DMS resources
For all other engine combinations (present as a single-select question "What would you like to do?"):
- Convert database — convert schema objects to the target engine (also produces an conversion assessment report)
- Assess database — run a compatibility assessment (also produces an conversion assessment report)
- Work with tree — browse the metadata model tree
- Clean up — delete migration project and related DMS resources
The customer can always type a custom request via "Other" (e.g., "work with tree", "show database statistics", or "exit"). If the customer selects "Other" and describes an action covered by this skill, handle it accordingly.
After each action completes, return to this menu by presenting the same selection again.
Note on metadata loading: start-metadata-model-import (with Refresh=false), start-metadata-model-assessment, and start-metadata-model-conversion all load the source tree for the scoped objects. If metadata was already imported in the current session for a given subtree, it does not need to be re-imported — these operations will work with what is already loaded.
Convert Database
Ask what to convert: Ask the customer what they want to convert (e.g., "all schemas", "schema public", "tables starting with PROD_").
Build selection rules: Translate the customer's natural language to selection rules JSON. Refer to Selection rules in DMS Schema Conversion for format, wildcards, and vendor-specific locators.
Run conversion: Call start-metadata-model-conversion with the migration project and selection rules. Extract RequestIdentifier from the response.
Wait for completion: Wait using the DMS waiter:
aws dms wait metadata-model-converted \
--migration-project-identifier <migration_project_identifier> \
--filter 'Name=schema-conversion-operation-id,Values=<RequestIdentifier>'
If the waiter fails or is unavailable, fall back to polling describe-metadata-model-conversions every 30 seconds with --filter Name=request-id,Values=<RequestIdentifier>. Terminal statuses: SUCCESS (proceed) or FAILED (check error).
Export conversion assessment report: On conversion success, call export-metadata-model-assessment with selection rules using rule-action: "explicit" (this API requires explicit rules, not include). Provide the customer with S3 links for both PDF and CSV reports (PdfReport.S3ObjectKey and CsvReport.S3ObjectKey).
Show summary: Download the Summary CSV from S3 using aws s3 cp s3://<bucket>/<CsvReport.S3ObjectKey> ./Summary.csv. Present its contents to the customer — show the number of objects per category, how many converted automatically, and how many have Action Items at each complexity level.
Post-convert sub-menu: After showing the summary, present options. Only show "Apply to target" if the target is a live target (not virtual):
"What would you like to do next?
- Fix Action Items — review and fix Action Items from the conversion assessment report
- Export as script — export converted DDL as SQL script to S3
- Apply to target — apply converted objects to the target database (live targets only)
- Back — return to actions menu"
- Fix Action Items: Load action-items.md and follow the fixing workflow there.
- Export as script: Run
aws dms start-metadata-model-export-as-script --migration-project-identifier <migration_project_identifier> --origin TARGET --selection-rules '<json>'. Extract RequestIdentifier. Wait via aws dms wait metadata-model-exported-as-script --migration-project-identifier <id> --filter 'Name=schema-conversion-operation-id,Values=<RequestIdentifier>'. Provide the S3 link on completion.
- Apply to target: Run
aws dms start-metadata-model-export-to-target --migration-project-identifier <migration_project_identifier> --selection-rules '<json>'. Optionally pass --overwrite-extension-pack if the customer confirms. Extract RequestIdentifier. Wait via aws dms wait metadata-model-exported-to-target --migration-project-identifier <id> --filter 'Name=schema-conversion-operation-id,Values=<RequestIdentifier>'. Inform the customer on completion.
- Back: Return to Actions Menu.
After completing, ask the customer what they'd like to do next.
Assess Database
Assessment analyzes conversion complexity and generates an conversion assessment report without actually converting any objects. Use this when the customer wants to understand the migration effort before committing to conversion.
Important: If the customer already ran a conversion on the same scope, a separate assessment is not necessary — conversion already produces an conversion assessment report. Inform the customer: "You already have an conversion assessment report from the conversion you ran. Would you like me to show that report instead, or do you want to re-run assessment on a different scope?"
Ask what to assess: Ask the customer what they want to assess (e.g., "all schemas", "schema pg_catalog", "tables starting with PROD_").
Build selection rules: Translate the customer's natural language to selection rules JSON. Refer to Selection rules in DMS Schema Conversion for format, wildcards, and vendor-specific locators.
Run assessment: Call start-metadata-model-assessment with the migration project and selection rules. Extract RequestIdentifier from the response.
Wait for completion: Wait using the DMS waiter:
aws dms wait metadata-model-assessed \
--migration-project-identifier <migration_project_identifier> \
--filter 'Name=schema-conversion-operation-id,Values=<RequestIdentifier>'
If the waiter fails or is unavailable, fall back to polling describe-metadata-model-assessments every 30 seconds with --filter Name=request-id,Values=<RequestIdentifier>. Terminal statuses: SUCCESS (proceed) or FAILED (check error).
Export conversion assessment report: On success, call export-metadata-model-assessment with the same selection rules. Provide the customer with S3 links for both PDF and CSV reports (PdfReport.S3ObjectKey and CsvReport.S3ObjectKey). The report contains conversion complexity statistics, Action Items, and estimated effort.
Show summary: Download the Summary CSV from S3 using aws s3 cp s3://<bucket>/<CsvReport.S3ObjectKey> ./Summary.csv. Present its contents to the customer — show the number of objects per category, how many converted automatically, and how many have Action Items at each complexity level.
Offer to fix Action Items: Ask the customer:
"Would you like me to help fix the Action Items?"
If yes, load action-items.md and follow the fixing workflow there.
After completing, ask the customer what they'd like to do next.
Review Action Items
Load action-items.md and follow the workflow there.
After completing, ask the customer what they'd like to do next.
Work with Tree
The metadata tree represents database schemas hierarchically. It contains two kinds of elements:
- Objects — actual database objects (tables, functions, views, sequences, indexes) that have SQL definitions
- Categories — virtual grouping containers ("Schemas", "Tables", "Functions") that organize objects for navigation but have no SQL definitions
The tree uses on-demand loading — metadata is retrieved from the database only when imported. See Navigating the metadata model for full details.
Navigation uses two APIs:
describe-metadata-model-children — returns the children of a given node, each with its own SelectionRules for drilling deeper
describe-metadata-model — returns the name, type, and SQL definition of a specific object
Both require --origin SOURCE or --origin TARGET and accept only explicit selection rules.
Show tree root: Call describe-metadata-model-children with selection rules targeting the root level and --origin SOURCE. If the tree is empty, automatically run a metadata import (same as Auto Import) and then re-display the tree root.
Navigate: Each child in the response has MetadataModelName and SelectionRules. Present the children and ask the customer what to do:
- Show children — drill into a child by calling
describe-metadata-model-children with the child's SelectionRules as the --selection-rules parameter
- Show definition — display the DDL for the selected object (see step 3). Only available for objects, not categories.
- Go up — return to the parent node
- Exit tree — return to actions menu
Show definition: Call describe-metadata-model with the child's SelectionRules and --origin SOURCE. The response includes Definition (SOURCE DDL) and TargetMetadataModels (list of converted counterparts with their own SelectionRules). To get the TARGET DDL, call describe-metadata-model again with SelectionRules from TargetMetadataModels[0] and --origin TARGET. Present both clearly labeled as SOURCE and TARGET.
Refresh from database: If the customer asks to refresh, run start-metadata-model-import with selection rules scoped to the current tree position, --origin SOURCE --refresh. Extract RequestIdentifier. Wait via aws dms wait metadata-model-imported --migration-project-identifier <id> --filter 'Name=schema-conversion-operation-id,Values=<RequestIdentifier>'. After refresh completes, re-display the current node's children.
After completing, ask the customer what they'd like to do next.
Convert Statement
Restriction: This feature is only available for SQL Server → PostgreSQL/Aurora PostgreSQL migration projects. Do NOT offer or show this option for any other source/target engine combination.
Determine context: Navigate the metadata tree to find the target location. For SQL Server this is server → database → schema; for other engines it's server → schema. Use describe-metadata-model-children to drill into nodes until you reach the schema level. Let the customer pick the schema (or database + schema for SQL Server). If the tree is empty, ask the customer to provide the location manually.
Get the SQL statement: Ask the customer for the SQL statement they want to convert.
Build selection rules for the schema: Build selection rules targeting the schema location. See Selection rules in DMS Schema Conversion for format and vendor-specific locators.
Create metadata model: Generate a unique model name (e.g., statement-<timestamp>). Call start-metadata-model-creation with:
--selection-rules — the schema selection rules from step 3
--metadata-model-name — the generated model name
--properties '{"StatementProperties": {"Definition": "<sql_statement>"}}'
Extract RequestIdentifier from the response. Wait via aws dms wait metadata-model-created --migration-project-identifier <id> --filter 'Name=schema-conversion-operation-id,Values=<RequestIdentifier>'.
Build selection rules for the statement: Build selection rules targeting the specific statement. See Selection rules in DMS Schema Conversion — use statement-name set to the model name.
Convert the created model: Call start-metadata-model-conversion with the statement selection rules from step 5. Extract RequestIdentifier. Wait via aws dms wait metadata-model-converted --migration-project-identifier <id> --filter 'Name=schema-conversion-operation-id,Values=<RequestIdentifier>'.
Show converted result: Call describe-metadata-model with the statement selection rules from step 5 and --origin SOURCE. From the response, extract TargetMetadataModels[0].SelectionRules. Then call describe-metadata-model with those target selection rules and --origin TARGET. Present the converted SQL from the Definition field clearly to the customer.
Export conversion assessment report: Call export-metadata-model-assessment with the source selection rules from step 5. Provide the customer with S3 links for PDF and CSV reports.
After completing, ask the customer what they'd like to do next.
Database Statistics
When a customer asks about their source database statistics — such as the number of objects, object types, schema sizes, or a general overview — run an assessment and present the results as a concise summary.
Build selection rules based on the customer's scope. If they specify particular schemas or objects, scope accordingly. If no scope is specified, default to all schemas on the source server (wildcard %). See Selection rules in DMS Schema Conversion for JSON format.
Run assessment: Call start-metadata-model-assessment with the migration project and selection rules. See schema-conversion-operations.md for execution details.
Wait for completion using the DMS waiter or fallback polling as described in schema-conversion-operations.md.
Export conversion assessment report: Call export-metadata-model-assessment with the same selection rules.
Download and present only what the customer asked for: Download the Summary CSV from S3:
aws s3 cp s3://<bucket>/<CsvReport.S3ObjectKey> ./Summary.csv
The report contains many data points. Present only the information the customer requested — do not dump the entire report. For example:
- If they asked "how many tables?" → show only the table count
- If they asked about a specific schema → show only that schema's stats
Offer next steps: Ask if they'd like to see conversion complexity or proceed with conversion.
Constraints:
- If the customer specifies a scope, use it. If not, default to all schemas.
- Present only what the customer asked for — do not overwhelm with unrequested data.
- Present statistics in a clear, tabular format.
After completing, ask the customer what they'd like to do next.
Clean Up
Delete the migration project and its associated DMS resources. Resources MUST be deleted in dependency order.
Confirm with customer: List the resources that will be deleted and ask for confirmation:
aws dms describe-migration-projects --filter Name=migration-project-identifier,Values=<migration_project_identifier>
Show the project name, source/target data providers, and instance profile.
Delete migration project:
aws dms delete-migration-project \
--migration-project-identifier <migration_project_identifier>
Delete data providers: Delete both source and target data providers:
aws dms delete-data-provider \
--data-provider-identifier <source_data_provider_identifier>
aws dms delete-data-provider \
--data-provider-identifier <target_data_provider_identifier>
Delete instance profile:
aws dms delete-instance-profile \
--instance-profile-identifier <instance_profile_identifier>
Delete subnet group:
aws dms delete-replication-subnet-group \
--replication-subnet-group-identifier <subnet_group_identifier>
Confirm completion: Inform the customer that all DMS Schema Conversion resources have been removed.
Constraints:
- You MUST get explicit customer confirmation before deleting any resources.
- You MUST delete in order: migration project first, then data providers, then instance profile, then subnet group — deleting in the wrong order will fail due to dependencies.
- You MUST NOT delete the underlying infrastructure (VPC, subnets, security groups, RDS instances, Secrets Manager secrets) — those are outside the scope of DMS Schema Conversion cleanup.
After completing, ask the customer what they'd like to do next.
Cancel Awareness
During any running async operation, if the customer requests cancellation, refer to cancel-operations.md for the correct cancel command mapping.
Security Considerations
- Credentials: All database credentials are stored in AWS Secrets Manager. Never embed credentials in data provider settings or log them to output.
- Encryption at rest: S3 buckets use SSE-S3 encryption (default). SSE-KMS is not supported by DMS Schema Conversion.
- Encryption in transit: Online connections should use
require or stronger SSL mode. none should only be used in isolated test environments.
- IAM least-privilege: All IAM roles use confused-deputy condition keys (
aws:SourceAccount, aws:SourceArn) and scoped resource ARNs.
- Network access: DMS instance profiles operate within VPC subnets with security group restrictions.
- See DMS security best practices for additional guidance.
Error Handling
When any operation fails or returns an error, load troubleshooting.md and follow its guidance to diagnose and resolve the issue. Explain the error to the customer in plain language and offer options: retry, try a different action, or exit.
1---2name: dms-schema-conversion3description: Handles the full DMS Schema Conversion lifecycle including creating migration projects, converting database schemas to a target engine, running compatibility assessments, navigating metadata trees, exporting converted DDL to S3, applying schema changes to a target database, and converting SQL statements between database engines. Applies when migrating database schemas between heterogeneous engines using AWS DMS Schema Conversion.4---5
6# DMS Schema Conversion
7
8## Overview
9
10This skill handles the full DMS Schema Conversion lifecycle — from first-time setup to running conversions on an existing project.
11
12> The AWS MCP server is recommended for streamlined execution, audit logging, and observability. When the MCP server is not available, all operations can be performed via AWS CLI directly.
13
14**Key documentation:**
15
16- [Selection rules in DMS Schema Conversion](https://docs.aws.amazon.com/dms/latest/userguide/sc-selection-rules.html) — scoping operations to specific objects
17- [Transformation rules in DMS Schema Conversion](https://docs.aws.amazon.com/dms/latest/userguide/sc-transformation-rules.html) — renaming schemas, tables, columns during conversion
18
19**Global constraint:** You MUST fetch and read any linked documentation before acting on it — do NOT rely on memory for any referenced material (selection rules, transformation rules, troubleshooting guides, network configuration, etc.). Documentation contains vendor-specific details that change between engines and API versions.
20
21---
22
23## Guardrail — where this skill's own files live (MCP vs local install)
24
25This skill can be loaded two ways, and they resolve the skill's own bundled files from different places. Determine how the skill was loaded before reading a reference:
26
27- **Loaded through the AWS MCP `retrieve_skill` tool:** The skill is not installed on the local filesystem. You MUST fetch each reference via `retrieve_skill` with the `file` parameter (e.g. `file="references/setup-wizard.md"`). Do NOT `file_read` these paths locally — they do not exist on disk.
28- **Installed locally** (e.g. `.kiro/skills/dms-schema-conversion/` or `~/.claude/skills/dms-schema-conversion/`): Read files from the local skill directory using relative paths.
29
30This distinction applies only to the skill's own packaged files. User data and session artifacts are always read from and written to the user's working directory. Never fetch or write customer data through `retrieve_skill`.
31
32---
33
34## Verify Dependencies
35
36Before starting, check that AWS CLI commands can be executed.
37
38**Constraints:**
39
40- You MUST verify that AWS CLI commands can be run (via MCP server tools or directly via shell)
41- You MUST inform the customer if no execution method is available and ask whether to proceed
42- You MUST ask the customer which AWS region to use — do NOT attempt to infer it from the STS response (it does not contain a region field). If the customer is unsure, suggest checking the `AWS_DEFAULT_REGION` environment variable or the `--region` flag they are using.
43
44---
45
46## Project Selection
47
48Check for existing migration projects:
49
50```
51aws dms describe-migration-projects
52```
53
54- **If exactly one project exists** → ask the customer: "Found migration project `<name>`. Would you like to use it, or create a new one?" If they confirm, store `migration_project_identifier` and proceed to [Actions Menu](#actions-menu). If they want a new one, run the setup wizard.
55- **If multiple projects exist** → list them and ask the customer to pick one, or offer to create a new project. Store `migration_project_identifier`, proceed to [Actions Menu](#actions-menu).
56- **If no projects exist** → ask: "No migration projects found. Would you like to create one?" If yes, load [setup-wizard.md](references/setup-wizard.md) and run the full setup wizard from Phase 1. After wizard completes, run [Auto Import](#auto-import), then proceed to [Actions Menu](#actions-menu).
57
58---
59
60## Auto Import
61
62> This section runs only after the setup wizard creates a new project. Do NOT run for existing projects.
63
641. Build selection rules to import **all schemas** from the source server. For `server-name`, use the data provider identifier (the short ID from the ARN, e.g., `JIFET2LUZJEJZPDYSOSGANOA2M`) or the literal `ServerName` value from the data provider settings (e.g., `"offline"` for offline sources). For SQL Server, you MUST include `database-name` in the object locator. See [Selection rules in DMS Schema Conversion](https://docs.aws.amazon.com/dms/latest/userguide/sc-selection-rules.html) for JSON format.
65
662. Run `start-metadata-model-import` with `--origin SOURCE --refresh` and the selection rules from step 1. Extract `RequestIdentifier` from the response.
67
683. Wait for import completion using the DMS waiter:
69
70 ```
71 aws dms wait metadata-model-imported \
72 --migration-project-identifier <migration_project_identifier> \
73 --filter 'Name=schema-conversion-operation-id,Values=<RequestIdentifier>'
74 ```
75
76 If the waiter fails or is unavailable, fall back to polling `describe-metadata-model-imports` every 30 seconds with `--filter Name=request-id,Values=<RequestIdentifier>`. Terminal statuses: **SUCCESS** (proceed) or **FAILED** (check error via the `Error` field in the response).
77
784. **Show discovered schemas:** On success, call `describe-metadata-model-children` with `--origin SOURCE` at the root level to list the imported schemas/databases. Present the discovered names to the customer so they can confirm the correct database connection was established:
79 > "Import complete. I found the following schemas/databases: `<list>`. Does this look correct?"
80
815. Proceed to [Actions Menu](#actions-menu).
82
83---
84
85## Actions Menu
86
87Present the actions menu using a structured selection tool (e.g., `AskUserQuestion`) if available — this gives the customer a clickable/selectable list.
88
89**For SQL Server → PostgreSQL/Aurora PostgreSQL projects** (present as a single-select question "What would you like to do?"):
90
911. **Convert database** — convert schema objects to the target engine (also produces an conversion assessment report)
922. **Assess database** — run a compatibility assessment (also produces an conversion assessment report)
933. **Convert statement** — convert a single SQL statement
944. **Clean up** — delete migration project and related DMS resources
95
96**For all other engine combinations** (present as a single-select question "What would you like to do?"):
97
981. **Convert database** — convert schema objects to the target engine (also produces an conversion assessment report)
992. **Assess database** — run a compatibility assessment (also produces an conversion assessment report)
1003. **Work with tree** — browse the metadata model tree
1014. **Clean up** — delete migration project and related DMS resources
102
103The customer can always type a custom request via "Other" (e.g., "work with tree", "show database statistics", or "exit"). If the customer selects "Other" and describes an action covered by this skill, handle it accordingly.
104
105After each action completes, return to this menu by presenting the same selection again.
106
107> **Note on metadata loading:** `start-metadata-model-import` (with `Refresh=false`), `start-metadata-model-assessment`, and `start-metadata-model-conversion` all load the source tree for the scoped objects. If metadata was already imported in the current session for a given subtree, it does not need to be re-imported — these operations will work with what is already loaded.
108
109---
110
111### Convert Database
112
1131. **Ask what to convert:** Ask the customer what they want to convert (e.g., "all schemas", "schema public", "tables starting with PROD_").
114
1152. **Build selection rules:** Translate the customer's natural language to selection rules JSON. Refer to [Selection rules in DMS Schema Conversion](https://docs.aws.amazon.com/dms/latest/userguide/sc-selection-rules.html) for format, wildcards, and vendor-specific locators.
116
1173. **Run conversion:** Call `start-metadata-model-conversion` with the migration project and selection rules. Extract `RequestIdentifier` from the response.
118
1194. **Wait for completion:** Wait using the DMS waiter:
120
121 ```
122 aws dms wait metadata-model-converted \
123 --migration-project-identifier <migration_project_identifier> \
124 --filter 'Name=schema-conversion-operation-id,Values=<RequestIdentifier>'
125 ```
126
127 If the waiter fails or is unavailable, fall back to polling `describe-metadata-model-conversions` every 30 seconds with `--filter Name=request-id,Values=<RequestIdentifier>`. Terminal statuses: **SUCCESS** (proceed) or **FAILED** (check error).
128
1295. **Export conversion assessment report:** On conversion success, call `export-metadata-model-assessment` with selection rules using `rule-action: "explicit"` (this API requires explicit rules, not `include`). Provide the customer with S3 links for both PDF and CSV reports (`PdfReport.S3ObjectKey` and `CsvReport.S3ObjectKey`).
130
1316. **Show summary:** Download the Summary CSV from S3 using `aws s3 cp s3://<bucket>/<CsvReport.S3ObjectKey> ./Summary.csv`. Present its contents to the customer — show the number of objects per category, how many converted automatically, and how many have Action Items at each complexity level.
132
1337. **Post-convert sub-menu:** After showing the summary, present options. Only show "Apply to target" if the target is a live target (not virtual):
134 > "What would you like to do next?
135 > 1. **Fix Action Items** — review and fix Action Items from the conversion assessment report
136 > 2. **Export as script** — export converted DDL as SQL script to S3
137 > 3. **Apply to target** — apply converted objects to the target database *(live targets only)*
138 > 4. **Back** — return to actions menu"
139
140 - **Fix Action Items:** Load [action-items.md](references/action-items.md) and follow the fixing workflow there.
141 - **Export as script:** Run `aws dms start-metadata-model-export-as-script --migration-project-identifier <migration_project_identifier> --origin TARGET --selection-rules '<json>'`. Extract `RequestIdentifier`. Wait via `aws dms wait metadata-model-exported-as-script --migration-project-identifier <id> --filter 'Name=schema-conversion-operation-id,Values=<RequestIdentifier>'`. Provide the S3 link on completion.
142 - **Apply to target:** Run `aws dms start-metadata-model-export-to-target --migration-project-identifier <migration_project_identifier> --selection-rules '<json>'`. Optionally pass `--overwrite-extension-pack` if the customer confirms. Extract `RequestIdentifier`. Wait via `aws dms wait metadata-model-exported-to-target --migration-project-identifier <id> --filter 'Name=schema-conversion-operation-id,Values=<RequestIdentifier>'`. Inform the customer on completion.
143 - **Back:** Return to [Actions Menu](#actions-menu).
144
145After completing, ask the customer what they'd like to do next.
146
147---
148
149### Assess Database
150
151Assessment analyzes conversion complexity and generates an conversion assessment report **without** actually converting any objects. Use this when the customer wants to understand the migration effort before committing to conversion.
152
153> **Important:** If the customer already ran a conversion on the same scope, a separate assessment is not necessary — conversion already produces an conversion assessment report. Inform the customer: "You already have an conversion assessment report from the conversion you ran. Would you like me to show that report instead, or do you want to re-run assessment on a different scope?"
154
1551. **Ask what to assess:** Ask the customer what they want to assess (e.g., "all schemas", "schema pg_catalog", "tables starting with PROD_").
156
1572. **Build selection rules:** Translate the customer's natural language to selection rules JSON. Refer to [Selection rules in DMS Schema Conversion](https://docs.aws.amazon.com/dms/latest/userguide/sc-selection-rules.html) for format, wildcards, and vendor-specific locators.
158
1593. **Run assessment:** Call `start-metadata-model-assessment` with the migration project and selection rules. Extract `RequestIdentifier` from the response.
160
1614. **Wait for completion:** Wait using the DMS waiter:
162
163 ```
164 aws dms wait metadata-model-assessed \
165 --migration-project-identifier <migration_project_identifier> \
166 --filter 'Name=schema-conversion-operation-id,Values=<RequestIdentifier>'
167 ```
168
169 If the waiter fails or is unavailable, fall back to polling `describe-metadata-model-assessments` every 30 seconds with `--filter Name=request-id,Values=<RequestIdentifier>`. Terminal statuses: **SUCCESS** (proceed) or **FAILED** (check error).
170
1715. **Export conversion assessment report:** On success, call `export-metadata-model-assessment` with the same selection rules. Provide the customer with S3 links for both PDF and CSV reports (`PdfReport.S3ObjectKey` and `CsvReport.S3ObjectKey`). The report contains conversion complexity statistics, Action Items, and estimated effort.
172
1736. **Show summary:** Download the Summary CSV from S3 using `aws s3 cp s3://<bucket>/<CsvReport.S3ObjectKey> ./Summary.csv`. Present its contents to the customer — show the number of objects per category, how many converted automatically, and how many have Action Items at each complexity level.
174
1757. **Offer to fix Action Items:** Ask the customer:
176 > "Would you like me to help fix the Action Items?"
177
178 If yes, load [action-items.md](references/action-items.md) and follow the fixing workflow there.
179
180After completing, ask the customer what they'd like to do next.
181
182---
183
184### Review Action Items
185
186Load [action-items.md](references/action-items.md) and follow the workflow there.
187
188After completing, ask the customer what they'd like to do next.
189
190---
191
192### Work with Tree
193
194The metadata tree represents database schemas hierarchically. It contains two kinds of elements:
195
196- **Objects** — actual database objects (tables, functions, views, sequences, indexes) that have SQL definitions
197- **Categories** — virtual grouping containers ("Schemas", "Tables", "Functions") that organize objects for navigation but have no SQL definitions
198
199The tree uses on-demand loading — metadata is retrieved from the database only when imported. See [Navigating the metadata model](https://docs.aws.amazon.com/dms/latest/userguide/sc-metadata-model.html#sc-metadata-model-navigating) for full details.
200
201**Navigation uses two APIs:**
202
203- `describe-metadata-model-children` — returns the children of a given node, each with its own `SelectionRules` for drilling deeper
204- `describe-metadata-model` — returns the name, type, and SQL definition of a specific object
205
206Both require `--origin SOURCE` or `--origin TARGET` and accept only `explicit` selection rules.
207
2081. **Show tree root:** Call `describe-metadata-model-children` with selection rules targeting the root level and `--origin SOURCE`. If the tree is empty, automatically run a metadata import (same as [Auto Import](#auto-import)) and then re-display the tree root.
209
2102. **Navigate:** Each child in the response has `MetadataModelName` and `SelectionRules`. Present the children and ask the customer what to do:
211 - **Show children** — drill into a child by calling `describe-metadata-model-children` with the child's `SelectionRules` as the `--selection-rules` parameter
212 - **Show definition** — display the DDL for the selected object (see step 3). Only available for objects, not categories.
213 - **Go up** — return to the parent node
214 - **Exit tree** — return to actions menu
215
2163. **Show definition:** Call `describe-metadata-model` with the child's `SelectionRules` and `--origin SOURCE`. The response includes `Definition` (SOURCE DDL) and `TargetMetadataModels` (list of converted counterparts with their own `SelectionRules`). To get the TARGET DDL, call `describe-metadata-model` again with `SelectionRules` from `TargetMetadataModels[0]` and `--origin TARGET`. Present both clearly labeled as **SOURCE** and **TARGET**.
217
2184. **Refresh from database:** If the customer asks to refresh, run `start-metadata-model-import` with selection rules scoped to the current tree position, `--origin SOURCE --refresh`. Extract `RequestIdentifier`. Wait via `aws dms wait metadata-model-imported --migration-project-identifier <id> --filter 'Name=schema-conversion-operation-id,Values=<RequestIdentifier>'`. After refresh completes, re-display the current node's children.
219
220After completing, ask the customer what they'd like to do next.
221
222---
223
224### Convert Statement
225
226> **Restriction:** This feature is only available for **SQL Server → PostgreSQL/Aurora PostgreSQL** migration projects. Do NOT offer or show this option for any other source/target engine combination.
227
2281. **Determine context:** Navigate the metadata tree to find the target location. For SQL Server this is server → database → schema; for other engines it's server → schema. Use `describe-metadata-model-children` to drill into nodes until you reach the schema level. Let the customer pick the schema (or database + schema for SQL Server). If the tree is empty, ask the customer to provide the location manually.
229
2302. **Get the SQL statement:** Ask the customer for the SQL statement they want to convert.
231
2323. **Build selection rules for the schema:** Build selection rules targeting the schema location. See [Selection rules in DMS Schema Conversion](https://docs.aws.amazon.com/dms/latest/userguide/sc-selection-rules.html) for format and vendor-specific locators.
233
2344. **Create metadata model:** Generate a unique model name (e.g., `statement-<timestamp>`). Call `start-metadata-model-creation` with:
235 - `--selection-rules` — the schema selection rules from step 3
236 - `--metadata-model-name` — the generated model name
237 - `--properties '{"StatementProperties": {"Definition": "<sql_statement>"}}'`
238
239 Extract `RequestIdentifier` from the response. Wait via `aws dms wait metadata-model-created --migration-project-identifier <id> --filter 'Name=schema-conversion-operation-id,Values=<RequestIdentifier>'`.
240
2415. **Build selection rules for the statement:** Build selection rules targeting the specific statement. See [Selection rules in DMS Schema Conversion](https://docs.aws.amazon.com/dms/latest/userguide/sc-selection-rules.html) — use `statement-name` set to the model name.
242
2436. **Convert the created model:** Call `start-metadata-model-conversion` with the statement selection rules from step 5. Extract `RequestIdentifier`. Wait via `aws dms wait metadata-model-converted --migration-project-identifier <id> --filter 'Name=schema-conversion-operation-id,Values=<RequestIdentifier>'`.
244
2457. **Show converted result:** Call `describe-metadata-model` with the statement selection rules from step 5 and `--origin SOURCE`. From the response, extract `TargetMetadataModels[0].SelectionRules`. Then call `describe-metadata-model` with those target selection rules and `--origin TARGET`. Present the converted SQL from the `Definition` field clearly to the customer.
246
2478. **Export conversion assessment report:** Call `export-metadata-model-assessment` with the **source** selection rules from step 5. Provide the customer with S3 links for PDF and CSV reports.
248
249After completing, ask the customer what they'd like to do next.
250
251---
252
253### Database Statistics
254
255When a customer asks about their source database statistics — such as the number of objects, object types, schema sizes, or a general overview — run an assessment and present the results as a concise summary.
256
2571. **Build selection rules** based on the customer's scope. If they specify particular schemas or objects, scope accordingly. If no scope is specified, default to all schemas on the source server (wildcard `%`). See [Selection rules in DMS Schema Conversion](https://docs.aws.amazon.com/dms/latest/userguide/sc-selection-rules.html) for JSON format.
258
2592. **Run assessment:** Call `start-metadata-model-assessment` with the migration project and selection rules. See [schema-conversion-operations.md](references/schema-conversion-operations.md) for execution details.
260
2613. **Wait for completion** using the DMS waiter or fallback polling as described in [schema-conversion-operations.md](references/schema-conversion-operations.md).
262
2634. **Export conversion assessment report:** Call `export-metadata-model-assessment` with the same selection rules.
264
2655. **Download and present only what the customer asked for:** Download the Summary CSV from S3:
266
267 ```
268 aws s3 cp s3://<bucket>/<CsvReport.S3ObjectKey> ./Summary.csv
269 ```
270
271 The report contains many data points. Present **only** the information the customer requested — do not dump the entire report. For example:
272 - If they asked "how many tables?" → show only the table count
273 - If they asked about a specific schema → show only that schema's stats
274
2756. **Offer next steps:** Ask if they'd like to see conversion complexity or proceed with conversion.
276
277**Constraints:**
278
279- If the customer specifies a scope, use it. If not, default to all schemas.
280- Present only what the customer asked for — do not overwhelm with unrequested data.
281- Present statistics in a clear, tabular format.
282
283After completing, ask the customer what they'd like to do next.
284
285---
286
287### Clean Up
288
289Delete the migration project and its associated DMS resources. Resources MUST be deleted in dependency order.
290
2911. **Confirm with customer:** List the resources that will be deleted and ask for confirmation:
292
293 ```
294 aws dms describe-migration-projects --filter Name=migration-project-identifier,Values=<migration_project_identifier>
295 ```
296
297 Show the project name, source/target data providers, and instance profile.
298
2992. **Delete migration project:**
300
301 ```
302 aws dms delete-migration-project \
303 --migration-project-identifier <migration_project_identifier>
304 ```
305
3063. **Delete data providers:** Delete both source and target data providers:
307
308 ```
309 aws dms delete-data-provider \
310 --data-provider-identifier <source_data_provider_identifier>
311 aws dms delete-data-provider \
312 --data-provider-identifier <target_data_provider_identifier>
313 ```
314
3154. **Delete instance profile:**
316
317 ```
318 aws dms delete-instance-profile \
319 --instance-profile-identifier <instance_profile_identifier>
320 ```
321
3225. **Delete subnet group:**
323
324 ```
325 aws dms delete-replication-subnet-group \
326 --replication-subnet-group-identifier <subnet_group_identifier>
327 ```
328
3296. **Confirm completion:** Inform the customer that all DMS Schema Conversion resources have been removed.
330
331**Constraints:**
332
333- You MUST get explicit customer confirmation before deleting any resources.
334- You MUST delete in order: migration project first, then data providers, then instance profile, then subnet group — deleting in the wrong order will fail due to dependencies.
335- You MUST NOT delete the underlying infrastructure (VPC, subnets, security groups, RDS instances, Secrets Manager secrets) — those are outside the scope of DMS Schema Conversion cleanup.
336
337After completing, ask the customer what they'd like to do next.
338
339---
340
341## Cancel Awareness
342
343During any running async operation, if the customer requests cancellation, refer to [cancel-operations.md](references/cancel-operations.md) for the correct cancel command mapping.
344
345---
346
347## Security Considerations
348
349- **Credentials:** All database credentials are stored in AWS Secrets Manager. Never embed credentials in data provider settings or log them to output.
350- **Encryption at rest:** S3 buckets use SSE-S3 encryption (default). SSE-KMS is not supported by DMS Schema Conversion.
351- **Encryption in transit:** Online connections should use `require` or stronger SSL mode. `none` should only be used in isolated test environments.
352- **IAM least-privilege:** All IAM roles use confused-deputy condition keys (`aws:SourceAccount`, `aws:SourceArn`) and scoped resource ARNs.
353- **Network access:** DMS instance profiles operate within VPC subnets with security group restrictions.
354- See [DMS security best practices](https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Security.html) for additional guidance.
355
356---
357
358## Error Handling
359
360When any operation fails or returns an error, load [troubleshooting.md](references/troubleshooting.md) and follow its guidance to diagnose and resolve the issue. Explain the error to the customer in plain language and offer options: retry, try a different action, or exit.