Schema Objects: DMS Schema Conversion and SCT

Lesson 47 showed that DMS copies the rows and leaves procedures, views, triggers, defaults and foreign keys behind. That part is handled by the AWS Schema Conversion Tool and its managed version, DMS Schema Conversion, which read the source schema, report what converts automatically and write the target code.

You’ll add some real objects to SaatShop on onprem-sql, list what DMS would miss, and then use DMS Schema Conversion to convert the schema to Amazon RDS for PostgreSQL. After checking the result with psql, you’ll fix two problems that migration teams run into all the time.

TimeYou needBy the end you can
120 minutesYou need Lessons 47 and 48 finished (onprem-sql stopped with SaatShop, dms-vpc-role), plus Start-SsmEndpoints.ps1, Remove-LabBucket.ps1 and your laptop signed in as saat-admin. It costs about USD 2 if you finish within two hours, mostly onprem-sql’s SQL Server Standard licence, since Schema Conversion itself has no extra charge. Everything apart from onprem-sql gets deleted at the end.You’ll list the schema objects DMS doesn’t move, set up DMS Schema Conversion (instance profile, data providers, migration project), then assess, convert and apply a SQL Server schema to PostgreSQL, read the action items, and deal with foreign keys during data loads.

What it is, in one line

The AWS Schema Conversion Tool, and DMS Schema Conversion in the console, convert a database’s schema and code from one engine to another and report what needs manual work.

In Simple Words

Translating a recipe book

Imagine moving a restaurant to another country. The movers (DMS) bring the food and the plates, but the recipe book is in the wrong language and the new kitchen measures in different units. Schema Conversion is the translator, and most recipes come out word for word, but a few call for an ingredient the new country doesn’t sell, so the translator sticks a note on them saying “chef, please decide”. Those notes are action items, and a good migration plan counts them early because each one means work for a person.

Engineer's View

How schema conversion works

DMS Schema Conversion is a managed, web-based service built on the engine of the AWS Schema Conversion Tool (SCT). You create an instance profile (subnets and a security group that can reach both databases), two data providers (engine and connection details, with credentials in Secrets Manager) and a migration project tying them together with an S3 bucket (versioning on) and IAM roles. SCT, the desktop app, is still around for offline work and very large estates.

The assessment report lists each object and how much of it converts automatically. Conversion maps types (nvarchar to varchar, datetime2 to timestamp) and turns IDENTITY into identity columns, procedures into functions or procedures, and triggers into trigger functions.

An extension pack schema (aws_sqlserver_ext) emulates SQL Server functions that PostgreSQL doesn’t have, and for SQL Server to PostgreSQL there’s also generative AI help with the hard objects.

Schema Conversion is meant for moves between different engines. For SQL Server to SQL Server, use native backup and restore (Lesson 46), or script the schema with SSMS or dbatools and load the data with DMS using TRUNCATE_BEFORE_LOAD. Whichever you choose, you have to deal with foreign keys and triggers on the target during the data load, or rows arrive in the wrong order and fail.

How it works, step by step

This is what happens in a Schema Conversion project.

1Connect to both databases

The instance profile puts Schema Conversion inside your VPC, where it reads credentials from Secrets Manager and connects to the source and target like any other client.

How DMS Schema Conversion assesses, converts and applies a SQL Server schema

2Assess and convert

It reads the source metadata, writes an assessment report and produces converted code that you can review object by object before anything touches the target.

3Apply, then load data

You apply the converted schema to the target first, and only after that does a DMS task load the rows, with TRUNCATE_BEFORE_LOAD so your schema stays as it is.

4Pick the right tool for each job

Each tool does one clear job:

What DMS tasks, Schema Conversion and SCT each move in a migration

Trouble starts when a team expects one tool to do everything, so plan schema, data and code testing as three separate workstreams.

✅ Checkpoint: You can name the parts of a Schema Conversion project, say which tool moves data and which converts schema, and what to use for SQL Server to SQL Server.

Hands-on lab: convert SaatShop's schema to PostgreSQL

Before you run any command, double-check it

Read every command twice before you press Enter. Check the target: the system or account, the IDs, the names and the sizes. These commands are for learning and were tested in our lab, not on your system. At work, run the read-only list commands first, follow your change process, make sure a backup exists, and ask a second person to check anything that changes or deletes data. You run them at your own risk.

Sign in and start the PostgreSQL target first, because it takes about 10 minutes, then start onprem-sql:

cd C:\aws-lab
aws login --profile saat-admin
$env:AWS_PROFILE = 'saat-admin'
$v = Get-Content C:\aws-lab\saat-vpc.json | ConvertFrom-Json
$acct = aws sts get-caller-identity --query Account --output text
$pgSg = aws ec2 create-security-group --group-name saat-pg-sg --description "PostgreSQL target" --vpc-id $v.VpcId --query GroupId --output text
aws ec2 authorize-security-group-ingress --group-id $pgSg --ip-permissions "IpProtocol=tcp,FromPort=5432,ToPort=5432,UserIdGroupPairs=[{GroupId=$($v.AppSg),Description=5432-from-app-sg}]" | Out-Null
aws rds create-db-instance --db-instance-identifier saat-pg --engine postgres --db-instance-class db.t4g.micro --allocated-storage 20 --storage-type gp3 --storage-encrypted --master-username saatadmin --manage-master-user-password --db-name saatshop --db-subnet-group-name saat-db-subnets --vpc-security-group-ids $pgSg --no-publicly-accessible --backup-retention-period 0 --tags Key=course,Value=saatvedha-aws Key=lesson,Value=49 --query "DBInstance.DBInstanceStatus" --output text
.\Start-SsmEndpoints.ps1
$src = aws ec2 describe-instances --filters "Name=tag:Name,Values=onprem-sql" "Name=instance-state-name,Values=stopped,running" --query "Reservations[0].Instances[0].InstanceId" --output text
$srcIp = aws ec2 describe-instances --instance-ids $src --query "Reservations[0].Instances[0].PrivateIpAddress" --output text
$srcSg = aws ec2 describe-security-groups --filters "Name=group-name,Values=saat-onprem-sql-sg" --query "SecurityGroups[0].GroupId" --output text
aws ec2 start-instances --instance-ids $src | Out-Null
do { Start-Sleep 20; $p = aws ssm describe-instance-information --filters "Key=InstanceIds,Values=$src" --query "InstanceInformationList[0].PingStatus" --output text } until ($p -eq 'Online')
"$src $srcIp"

You should see something like this:

creating
i-0a1b2c3d4e5f60718 10.20.11.143

1Add real objects and list what DMS would miss

Paste this whole block. It adds a customers table, a foreign key, a view, two procedures and a trigger, and then counts the user objects:

function Invoke-Src([string]$Sql) {
  $line = 'sqlcmd -S . -E -C -h -1 -W -s " " -d SaatShop -Q "' + $Sql + '"'
  @{ commands = @($line) } | ConvertTo-Json | Set-Content src-cmd.json
  $cmd = aws ssm send-command --document-name AWS-RunPowerShellScript --instance-ids $src --parameters file://src-cmd.json --query Command.CommandId --output text
  do { Start-Sleep 5; $st = aws ssm get-command-invocation --command-id $cmd --instance-id $src --query Status --output text 2>$null } until ($st -in 'Success', 'Failed', 'TimedOut')
  aws ssm get-command-invocation --command-id $cmd --instance-id $src --query StandardOutputContent --output text
}
Invoke-Src "CREATE TABLE dbo.Customers (CustomerId int IDENTITY PRIMARY KEY, Name nvarchar(100) NOT NULL, Email nvarchar(200) UNIQUE, CreatedAt datetime2 DEFAULT SYSUTCDATETIME()); INSERT dbo.Customers (Name, Email) VALUES (N'Asha', N'asha@example.com'), (N'Ravi', N'ravi@example.com'), (N'Meena', N'meena@example.com'); ALTER TABLE dbo.Orders ADD CustomerId int NULL; CREATE TABLE dbo.OrderAudit (AuditId int IDENTITY PRIMARY KEY, OrderId int, ChangedAt datetime2 DEFAULT SYSUTCDATETIME(), ChangedBy sysname DEFAULT SUSER_SNAME());" | Out-Null
Invoke-Src "UPDATE dbo.Orders SET CustomerId = 1 + OrderId % 3; ALTER TABLE dbo.Orders ADD CONSTRAINT FK_Orders_Customers FOREIGN KEY (CustomerId) REFERENCES dbo.Customers (CustomerId);" | Out-Null
Invoke-Src "CREATE VIEW dbo.vw_CustomerTotals AS SELECT c.CustomerId, c.Name, COUNT(*) AS OrderCount, SUM(o.Amount) AS Total FROM dbo.Customers c JOIN dbo.Orders o ON o.CustomerId = c.CustomerId GROUP BY c.CustomerId, c.Name" | Out-Null
Invoke-Src "CREATE PROCEDURE dbo.usp_TopCustomers @n int = 5 AS BEGIN SET NOCOUNT ON; SELECT TOP (@n) Name, Total, CONVERT(varchar(10), GETDATE(), 23) AS AsOf FROM dbo.vw_CustomerTotals ORDER BY Total DESC; END" | Out-Null
Invoke-Src "CREATE PROCEDURE dbo.usp_CountRows @table sysname AS BEGIN DECLARE @sql nvarchar(400) = N'SELECT COUNT(*) FROM dbo.' + QUOTENAME(@table); EXEC sp_executesql @sql; END" | Out-Null
Invoke-Src "CREATE TRIGGER dbo.trg_Orders_Audit ON dbo.Orders AFTER UPDATE AS BEGIN SET NOCOUNT ON; INSERT dbo.OrderAudit (OrderId) SELECT OrderId FROM inserted; END" | Out-Null
Invoke-Src "SET NOCOUNT ON; SELECT type_desc, COUNT(*) FROM sys.objects WHERE is_ms_shipped = 0 GROUP BY type_desc ORDER BY type_desc; SELECT 'IDENTITY_COLUMN', COUNT(*) FROM sys.identity_columns c JOIN sys.objects o ON o.object_id = c.object_id WHERE o.is_ms_shipped = 0;"

You should see something like this:

DEFAULT_CONSTRAINT 4
FOREIGN_KEY_CONSTRAINT 1
PRIMARY_KEY_CONSTRAINT 3
SQL_STORED_PROCEDURE 2
SQL_TRIGGER 1
UNIQUE_CONSTRAINT 1
USER_TABLE 3
VIEW 1
IDENTITY_COLUMN 3

A DMS task would bring across the 3 tables, their rows and the 3 primary keys, and everything else on this list would be missing, along with IX_Orders_Customer. Taking this inventory first tells you how much schema work a migration really involves.

2Set up Schema Conversion

Paste this whole block. It creates the bucket, secrets, roles, network rules, instance profile, data providers and the migration project:

$sc = "saat-sc-$acct-ap-south-1-an"
aws s3api create-bucket --bucket $sc --bucket-namespace account-regional --region ap-south-1 --create-bucket-configuration LocationConstraint=ap-south-1 | Out-Null
aws s3api put-bucket-versioning --bucket $sc --versioning-configuration Status=Enabled
$dmsPw = aws secretsmanager get-random-password --password-length 20 --exclude-punctuation --require-each-included-type --query RandomPassword --output text
Invoke-Src "ALTER LOGIN dms_user WITH PASSWORD = '$dmsPw'; GRANT VIEW ANY DEFINITION TO dms_user;" | Out-Null
@{ username = 'dms_user'; password = $dmsPw } | ConvertTo-Json | Set-Content src-secret.json
$srcSecret = aws secretsmanager create-secret --name saat-sc-source --secret-string file://src-secret.json --query ARN --output text
Remove-Item src-secret.json
aws rds wait db-instance-available --db-instance-identifier saat-pg
$pgHost = aws rds describe-db-instances --db-instance-identifier saat-pg --query "DBInstances[0].Endpoint.Address" --output text
$pgSecret = aws rds describe-db-instances --db-instance-identifier saat-pg --query "DBInstances[0].MasterUserSecret.SecretArn" --output text
'{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "dms.amazonaws.com" }, "Action": "sts:AssumeRole" } ] }' | Set-Content sc-trust.json
@{ Version = '2012-10-17'; Statement = @(
  @{ Effect = 'Allow'; Action = @('s3:ListBucket', 's3:GetBucketLocation', 's3:GetBucketVersioning'); Resource = "arn:aws:s3:::$sc" },
  @{ Effect = 'Allow'; Action = @('s3:PutObject', 's3:GetObject', 's3:GetObjectVersion'); Resource = "arn:aws:s3:::$sc/*" }) } | ConvertTo-Json -Depth 5 | Set-Content sc-s3.json
@{ Version = '2012-10-17'; Statement = @(@{ Effect = 'Allow'; Action = @('secretsmanager:GetSecretValue', 'secretsmanager:DescribeSecret'); Resource = @($srcSecret, $pgSecret) }) } | ConvertTo-Json -Depth 5 | Set-Content sc-secrets.json
$s3Role = aws iam create-role --role-name saat-sc-s3-role --assume-role-policy-document file://sc-trust.json --query Role.Arn --output text
aws iam put-role-policy --role-name saat-sc-s3-role --policy-name sc-s3 --policy-document file://sc-s3.json
$secRole = aws iam create-role --role-name saat-sc-secrets-role --assume-role-policy-document file://sc-trust.json --query Role.Arn --output text
aws iam put-role-policy --role-name saat-sc-secrets-role --policy-name sc-secrets --policy-document file://sc-secrets.json
$scSg = aws ec2 create-security-group --group-name saat-sc-sg --description "DMS Schema Conversion" --vpc-id $v.VpcId --query GroupId --output text
aws ec2 authorize-security-group-ingress --group-id $srcSg --ip-permissions "IpProtocol=tcp,FromPort=1433,ToPort=1433,UserIdGroupPairs=[{GroupId=$scSg,Description=1433-from-sc}]" | Out-Null
aws ec2 authorize-security-group-ingress --group-id $pgSg --ip-permissions "IpProtocol=tcp,FromPort=5432,ToPort=5432,UserIdGroupPairs=[{GroupId=$scSg,Description=5432-from-sc}]" | Out-Null
aws dms create-replication-subnet-group --replication-subnet-group-identifier saat-dms-subnets --replication-subnet-group-description "saat-vpc private subnets" --subnet-ids $v.PrivateA $v.PrivateB | Out-Null
Start-Sleep 15
$ip = aws dms create-instance-profile --instance-profile-name saat-sc-profile --subnet-group-identifier saat-dms-subnets --vpc-security-groups $scSg --network-type IPV4 --no-publicly-accessible --query InstanceProfile.InstanceProfileArn --output text
$srcDp = aws dms create-data-provider --data-provider-name saat-onprem-sqlserver --engine sqlserver --settings "MicrosoftSqlServerSettings={ServerName=$srcIp,Port=1433,DatabaseName=SaatShop,SslMode=none}" --query DataProvider.DataProviderArn --output text
$tgtDp = aws dms create-data-provider --data-provider-name saat-pg --engine postgres --settings "PostgreSqlSettings={ServerName=$pgHost,Port=5432,DatabaseName=saatshop,SslMode=require}" --query DataProvider.DataProviderArn --output text
$proj = aws dms create-migration-project --migration-project-name saat-sc --source-data-provider-descriptors "DataProviderIdentifier=$srcDp,SecretsManagerSecretId=$srcSecret,SecretsManagerAccessRoleArn=$secRole" --target-data-provider-descriptors "DataProviderIdentifier=$tgtDp,SecretsManagerSecretId=$pgSecret,SecretsManagerAccessRoleArn=$secRole" --instance-profile-identifier $ip --schema-conversion-application-attributes "S3BucketPath=s3://$sc,S3BucketRoleArn=$s3Role" --query MigrationProject.MigrationProjectArn --output text
$proj

You should see something like this:

arn:aws:dms:ap-south-1:111122223333:migration-project:ABCDEFGHIJKLMNOPQRSTUVWXYZ

The source secret holds dms_user’s new password, and the target uses the secret RDS already manages for saat-pg. Each quoted argument above mixes text with variables, which is why every one of them is wrapped in double quotes.

3Assess, convert and apply in the console

The main Schema Conversion screen lives in the console. Open AWS DMS > Migration projects > saat-sc > Schema conversion and choose Launch schema conversion. The first launch takes 10 to 15 minutes.

  1. In the source pane, expand SaatShop > Schemas, tick dbo and choose Actions > Assess.
  2. Open the assessment summary, which should say something like “11 of 13 objects can be converted automatically”, with action items on the procedures.
  3. Choose Actions > Convert. A schema called saatshop_dbo shows up in the target pane, and if you click usp_CountRows you can compare the T-SQL with the converted PL/pgSQL and read its action item about dynamic SQL.
  4. Tick saatshop_dbo in the target pane and choose Actions > Apply changes.
  5. Choose Export results to save the assessment as PDF and CSV in the saat-sc bucket.

Keep the PDF for your project plan, because the action item count is the honest measure of how much manual work is still ahead.

DMS Schema Conversion assessment for migration project saat-sc with 11 of 13 objects converting automatically
DMS Schema Conversion after Assess and Convert. Most objects convert by themselves, and usp_CountRows has an action item for its dynamic SQL.
AWS Schema Conversion Tool lab output: source objects and converted PostgreSQL schemas
Source object counts and the converted schemas should look something like this.

4Check the converted schema in PostgreSQL

Paste this whole block. It starts a small checker instance with psql and lists what Schema Conversion created:

$base = aws ssm get-parameter --name /aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64 --query Parameter.Value --output text
$chk = aws ec2 run-instances --image-id $base --instance-type t3.micro --subnet-id $v.PrivateA --security-group-ids $v.AppSg --iam-instance-profile Name=saat-ec2-ssm-profile --metadata-options HttpTokens=required --user-data "#!/bin/bash
dnf install -y postgresql16" --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=pgcheck},{Key=course,Value=saatvedha-aws},{Key=lesson,Value=49}]' --query "Instances[0].InstanceId" --output text
do { Start-Sleep 20; $p = aws ssm describe-instance-information --filters "Key=InstanceIds,Values=$chk" --query "InstanceInformationList[0].PingStatus" --output text } until ($p -eq 'Online')
Start-Sleep 60
$pgPw = (aws secretsmanager get-secret-value --secret-id $pgSecret --query SecretString --output text | ConvertFrom-Json).password
function Invoke-Pg([string]$Sql) {
  $b64 = [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes($pgPw))
  $lines = @('export PGPASSWORD=$(echo ' + $b64 + ' | base64 -d)', "psql 'host=$pgHost dbname=saatshop user=saatadmin sslmode=require' -At -F ' ' -c ""$Sql""")
  @{ commands = $lines } | ConvertTo-Json | Set-Content pg-cmd.json
  $cmd = aws ssm send-command --document-name AWS-RunShellScript --instance-ids $chk --parameters file://pg-cmd.json --query Command.CommandId --output text
  do { Start-Sleep 5; $st = aws ssm get-command-invocation --command-id $cmd --instance-id $chk --query Status --output text 2>$null } until ($st -in 'Success', 'Failed', 'TimedOut')
  aws ssm get-command-invocation --command-id $cmd --instance-id $chk --query "[StandardOutputContent,StandardErrorContent]" --output text
}
Invoke-Pg "\dn"
Invoke-Pg "SELECT table_name, table_type FROM information_schema.tables WHERE table_schema = 'saatshop_dbo' ORDER BY 1"
Invoke-Pg "SELECT routine_name, routine_type FROM information_schema.routines WHERE routine_schema = 'saatshop_dbo' ORDER BY 1"

You should see something like this:

aws_sqlserver_ext saatadmin
aws_sqlserver_ext_data saatadmin
public pg_database_owner
saatshop_dbo saatadmin

customers BASE TABLE
orderaudit BASE TABLE
orders BASE TABLE
vw_customertotals VIEW

fn_trg_orders_audit FUNCTION
usp_countrows PROCEDURE
usp_topcustomers PROCEDURE

The tables, view, procedures and trigger function now exist in saatshop_dbo in lower case, with the extension pack schemas next to them. A DMS task with TRUNCATE_BEFORE_LOAD could now load the rows into this schema.

DMS Schema Conversion target pane listing the saatshop_dbo tables, view, procedures and trigger function after Apply changes
The target after Apply changes, with the tables, view, procedures and trigger function now in saatshop_dbo.

✅ Checkpoint: The inventory shows 4 defaults, 1 foreign key, 2 procedures, 1 trigger, 1 view and 3 identity columns. The assessment PDF is in the saat-sc bucket, and saat-pg has the saatshop_dbo schema with tables, a view and routines.

Break It, Then Fix It

These two problems hold up real conversion projects.

1Break it: Schema Conversion can’t reach the source

Remove the 1433 rule for Schema Conversion, then refresh the source in the console:

aws ec2 revoke-security-group-ingress --group-id $srcSg --ip-permissions "IpProtocol=tcp,FromPort=1433,ToPort=1433,UserIdGroupPairs=[{GroupId=$scSg}]" | Out-Null

On the Schema conversion screen, pick the source server and choose Refresh from database. You’ll get an error like this:

Failed to connect to the source data provider saat-onprem-sqlserver. Check that the database is reachable from the instance profile network and that the security groups allow the connection.

Schema Conversion connects from the instance profile’s security group, and not from your laptop or the DMS replication instance. Teams often open the database to the replication instance and forget that Schema Conversion has a group of its own. Fix: allow 1433 from saat-sc-sg again and refresh:

aws ec2 authorize-security-group-ingress --group-id $srcSg --ip-permissions "IpProtocol=tcp,FromPort=1433,ToPort=1433,UserIdGroupPairs=[{GroupId=$scSg,Description=1433-from-sc}]" | Out-Null

The source tree loads again in the console.

2Break it: rows arrive before their parent

A DMS full load runs tables in parallel, so an order can turn up before its customer does. Try it yourself:

Invoke-Pg "INSERT INTO saatshop_dbo.orders (customer, amount, customerid) VALUES ('Test', 1.00, 999)"

You’ll get an error like this:

ERROR:  insert or update on table "orders" violates foreign key constraint "fk_orders_customers"
DETAIL:  Key (customerid)=(999) is not present in table "customers".
Schema conversion problems: source connection timeout and foreign key violation
Both problems and their fixes should look something like this.

The schema is fine, but foreign keys and triggers fire during the load and the load order isn’t guaranteed. On PostgreSQL targets, DMS loads normally run with session_replication_role set to replica, which skips foreign key checks and ordinary triggers for that session. Fix: try the same setting by hand, then remove the test row:

Invoke-Pg "SET session_replication_role = replica; INSERT INTO saatshop_dbo.orders (customer, amount, customerid) VALUES ('Test', 1.00, 999); DELETE FROM saatshop_dbo.orders WHERE customer = 'Test'; SELECT 'ok'"

You should see something like this:

ok

In a DMS task you’d put afterConnectScript=SET session_replication_role = 'replica' on the PostgreSQL target endpoint, or add the foreign keys and triggers once the full load is done. For SQL Server targets, disable foreign keys and triggers during the load and switch them back on before CDC catches up.

Now clean up. onprem-sql keeps the new objects and stays stopped for Lesson 50:

aws dms delete-migration-project --migration-project-identifier $proj | Out-Null
Start-Sleep 30
aws dms delete-data-provider --data-provider-identifier $srcDp | Out-Null
aws dms delete-data-provider --data-provider-identifier $tgtDp | Out-Null
aws dms delete-instance-profile --instance-profile-identifier $ip | Out-Null
aws ec2 terminate-instances --instance-ids $chk | Out-Null
aws rds delete-db-instance --db-instance-identifier saat-pg --skip-final-snapshot --query "DBInstance.DBInstanceStatus" --output text
aws secretsmanager delete-secret --secret-id $srcSecret --force-delete-without-recovery | Out-Null
aws ec2 revoke-security-group-ingress --group-id $srcSg --ip-permissions "IpProtocol=tcp,FromPort=1433,ToPort=1433,UserIdGroupPairs=[{GroupId=$scSg}]" | Out-Null
aws ec2 stop-instances --instance-ids $src | Out-Null
foreach ($r in 'saat-sc-s3-role', 'saat-sc-secrets-role') { $pn = aws iam list-role-policies --role-name $r --query "PolicyNames[0]" --output text; aws iam delete-role-policy --role-name $r --policy-name $pn; aws iam delete-role --role-name $r }
.\Remove-LabBucket.ps1 -Bucket $sc
aws rds wait db-instance-deleted --db-instance-identifier saat-pg
aws dms delete-replication-subnet-group --replication-subnet-group-identifier saat-dms-subnets
aws ec2 delete-security-group --group-id $scSg
aws ec2 delete-security-group --group-id $pgSg
.\Stop-SsmEndpoints.ps1
Remove-Item sc-trust.json, sc-s3.json, sc-secrets.json, src-cmd.json, pg-cmd.json

✅ Checkpoint: You fixed a source connection failure with the Schema Conversion security group rule and a foreign key violation with session_replication_role. The project, data providers, instance profile, saat-pg, secret, roles, bucket and security groups are deleted, and onprem-sql is stopping.

This happened at work

The 2,000 procedures nobody counted

An insurance broker planned to move from SQL Server to Aurora PostgreSQL in three months to save on licences. Their DMS proof of concept copied all the data in one weekend, so the plan looked safe.

Nobody ran an assessment until month two, and when they did, the report showed 2,100 stored procedures, 340 of them with action items for things like cursors, dynamic SQL, linked server queries and CLR functions. Every one of those needed a developer and a tester.

The three months turned into nine, with a first phase that only moved the reporting database. Now they run the assessment in week one and build the timeline from the action item count, and not from how quickly the data copies.

Common mistakes and troubleshooting

MistakeWhat happensWhat to do
Trusting a DMS-only proof of conceptSchema and code work discovered too lateRun an assessment in week one
Letting DMS create target tablesNo identity, defaults, FKs or code on the targetApply the converted schema first, then use TRUNCATE_BEFORE_LOAD
Forgetting the Schema Conversion security groupThe source or target connection failsAllow the instance profile SG on both databases
Foreign keys and triggers on during loadFK violations and triggers doing duplicate workSet session_replication_role to replica, or add them after the load
Bucket without versioningThe migration project setup failsEnable versioning on the Schema Conversion bucket
Using Schema Conversion for SQL Server to SQL ServerThe wrong tool, and wasted timeNative backup, or a scripted schema plus DMS

Interview questions

Click a question to open it. Each one is worded the way an interviewer would ask it, and underneath you’ll find why they ask and one way you could answer in your own words.

Fresher level

1. Can you explain in simple words what the AWS Schema Conversion Tool does?

Why they ask this: They want to check you know where schema conversion fits in a migration and that it’s a separate job from moving the data.

How you might answer: It converts schema and code from one database engine to another, say SQL Server to PostgreSQL. You can use the desktop SCT, or DMS Schema Conversion in the console.

It also gives you a report of what it couldn’t convert, so you know where the manual work is.

2. A teammate thinks DMS will copy the whole database. What would you tell them DMS leaves behind?

Why they ask this: Missing objects are a common reason apps break after a migration, so they want to see you know where DMS falls short.

How you might answer: I’d explain that DMS moves tables and data but not secondary indexes, foreign keys, defaults or identity properties, and it doesn’t bring views, procedures, functions or triggers either.

So we sort out the schema with a schema tool first and load the data afterwards.

3. You open a conversion report and see a list of action items. What does that mean?

Why they ask this: They want to know you can read an assessment report and spot the parts where a person has to step in.

How you might answer: An action item is an object or statement the tool couldn’t convert by itself, so someone has to rewrite it by hand or make a call on it.

I use the action item count as a rough guide to how much manual effort the migration will take.

2–5 years experience

4. Walk me through what you set up before you can use DMS Schema Conversion.

Why they ask this: There are several pieces and missing any one of them stops the project, so they want to see you’ve really built it.

How you might answer: I start with an instance profile that has a subnet group and security group, then add data providers for source and target with the credentials kept in Secrets Manager.

I also need a versioned S3 bucket and IAM roles that let the service reach S3 and the secrets, and the migration project links all of that together.

5. Your full load keeps failing because the target already has foreign keys. How would you handle it?

Why they ask this: They want to see you understand load order problems and know the engine-specific ways round them.

How you might answer: DMS loads tables in parallel, so child rows can land before their parents. With a PostgreSQL target I’d set session_replication_role to replica on the target endpoint, which turns off the FK checks during the load.

With SQL Server I’d disable the foreign keys and triggers for the full load, or else only create the foreign keys once the load has finished.

6. You need to move a SQL Server database to RDS SQL Server with its full schema. How would you do it?

Why they ask this: For a same-engine move they want to hear you pick the simplest path and skip conversion tools you don’t need.

How you might answer: Native backup and restore is the simplest, since it brings everything across exactly as it is. If downtime has to be low, I’d script the schema with SSMS or dbatools and apply it on RDS.

After that I’d run DMS with TRUNCATE_BEFORE_LOAD so my schema stays, and use CDC to keep in sync until cutover.

Senior level

7. A company wants to leave SQL Server for PostgreSQL. How would you estimate the effort before anyone commits?

Why they ask this: They want to see you plan a big engine change from real data, and not hand over a number based on gut feeling.

How you might answer: I’d run assessments on all the databases and count the action items by type. Then I’d do sample conversions of the hardest objects to see how long they really take, and look at the SQL inside the app and the drivers it uses.

I’d add time for testing and performance tuning on top, and plan the work in waves starting with the simple databases.

8. The conversion tool says everything converted fine. What risks would still worry you?

Why they ask this: A senior person knows a clean report doesn’t mean the app will behave the same, so they want to see you think beyond syntax.

How you might answer: I’d worry about differences in behaviour, things like collation, NULL handling, transactions and case sensitivity, and converted code can also run slower on the new engine.

There’s also SQL written inside the app code, which the tool never sees, and the operational side, jobs and monitoring, which has to be rebuilt.

Quick quiz

Q1. What does Schema Conversion convert?

  1. Rows
  2. Schema and code
  3. Backups
  4. Users only
Show answer

B: moving the data is DMS’s job.

Q2. Which bucket setting does a migration project need?

  1. Object Lock
  2. Versioning
  3. Public access
  4. Requester pays
Show answer

B: versioning has to be on.

Q3. Why did the console fail to reach the source?

  1. Wrong password
  2. The Schema Conversion SG lost its 1433 rule
  3. PostgreSQL was down
  4. No extension pack
Show answer

B: it connects from the instance profile SG.

Q4. Why might a DMS full load hit FK violations?

  1. Tables load in parallel
  2. DMS skips keys
  3. Wrong edition
  4. TLS
Show answer

A: child rows can arrive before their parents.

Q5. What should you use for SQL Server to RDS SQL Server?

  1. Schema Conversion
  2. Native backup or scripted schema plus DMS
  3. Glue
  4. Nothing
Show answer

B: Schema Conversion is meant for different engines.

Quick recap

  • DMS moves the data, while Schema Conversion and SCT move schema and code.
  • Take an inventory of the source first: defaults, FKs, identity, views, procedures and triggers.
  • A project needs an instance profile, data providers, secrets, a versioned bucket and roles.
  • The action item count is the real measure of migration effort.
  • During loads, handle FKs and triggers with session_replication_role or add them afterwards.

Next lesson

Lesson 50: SQL Server on EC2 and log shipping → Next you’ll build SQL Server on EC2 with a proper storage layout and ship logs to it from onprem-sql.

Further reading: AWS Schema Conversion Tool

Want to go deeper into AWS Schema Conversion Tool? Read Converting database schemas using DMS Schema Conversion and AWS Schema Conversion Tool User Guide. You can also see the full plan for this course on the AWS Cloud Administration course page.

Scroll to Top

This website uses cookies

We use a few cookies to keep this site working. If you allow it, we also use Google Analytics to count visits so we can improve our lessons. You can accept all, deny the optional ones, or choose what to allow.