Skip to Content
Cloud Engineering Academy
13. Microsoft-to-AWS Migration

Data services side by side: Azure SQL, Cosmos DB and Blob Storage vs AWS

Compare Azure SQL, SQL Managed Instance, SQL Server on VMs, Cosmos DB, Blob Storage and Azure Cache with RDS for SQL Server, Aurora PostgreSQL with Babelfish, DynamoDB, S3 and ElastiCache, and learn which behaviours change in your connection strings, access patterns and backups.

intermediate⏱ 1 h 30 min🟢 FreeSAA-C03SAP-C03DEA-C01

Assumes: .NET 10 LTS · Microsoft.Data.SqlClient · AWS SDK for .NET v4 (AWSSDK.S3) · SQL Server 2019 to 2022 sources · Aurora PostgreSQL with Babelfish · Region us-east-1. Verified against official sources on 2026-11-18.

Learning objectives

By the end of this lesson you can:

  • Pick the AWS target for each Azure data service: SQL Database, Managed Instance, SQL Server on a VM, Cosmos DB, Blob Storage, Azure Cache for Redis and Azure Files.
  • Explain what RDS for SQL Server does not let you do compared with a self-managed instance or a Managed Instance, and what Babelfish can and cannot absorb.
  • Change a .NET connection string and credential flow correctly for RDS and Aurora.
  • Replace a SAS token with an S3 presigned URL in C#, and explain the security differences.
  • Map Blob tiers, soft delete and immutable blobs to S3 storage classes, versioning and Object Lock.

Prerequisites

Why this matters in banking

A bank's data estate is the part regulators care about most and the part that is hardest to move twice. Harbourline's ledger runs on SQL Server with SQL Agent jobs, linked servers and a CLR function that computes IBAN check digits. Statement PDFs sit in Blob Storage under immutable retention policies. Customer sessions are in Redis. An "everything to Aurora" plan sounds modern, but breaks on the CLR function. A "lift the Blob containers to S3" plan loses the immutability guarantee if nobody turns on Object Lock before the first file lands.

The cost of a wrong data choice is not an outage; it is a second migration with another change-approval cycle and another reconciliation. This lesson helps you choose the target once.

The idea in plain language

Data services answer three questions: what shape is the data (tables, documents, files, cache entries), how much of the database engine do you control, and how is access granted.

  • Relational (SQL Server family): you keep tables, T-SQL and transactions. The choice is how much of the SQL Server instance (agents, linked servers, CLR, cross-database features) you need to control.
  • Key-value and document (Cosmos DB): single-digit-millisecond lookups by key at scale. On AWS the usual counterpart is DynamoDB, but it is a redesign, not a port: you model around access patterns, not around queries.
  • Objects (Blob Storage): files addressed by name. AWS's S3 does the same job, with buckets instead of containers.
  • Cache (Redis): in-memory speed. ElastiCache (Valkey or Redis OSS) is the near-direct counterpart.

Analogy: a SQL Server instance is a full branch back office with its own filing system and staff. Azure SQL Database is a desk in a shared office: tidy, cheap, but you cannot bring your own cabinet. RDS for SQL Server is a managed back office: someone else runs the building, you can bring most of your cabinets but not the master key to the strongroom (sysadmin).

What problem the AWS services solve

AzureAWS targetWhen it fitsHonest limits
Azure SQL DatabaseAmazon RDS for SQL Server, or Aurora PostgreSQL with Babelfish for apps willing to test compatibilityMost line-of-business databasesRDS is instance-shaped, not per-database serverless; features such as elastic pools have no direct twin
SQL Managed InstanceRDS for SQL Server (closest managed), or RDS Custom for SQL Server where you need OS or instance accessApps needing SQL Agent, cross-database queries, linked serversRDS gives you SQL Agent and many instance features, but not sysadmin; confirm each feature in the RDS SQL Server feature list ⚠ VERIFY
SQL Server on an Azure VMSQL Server on EC2Full control, third-party agents, unsupported featuresYou own patching, backups, HA (Always On) and licensing
Cosmos DB (NoSQL API)DynamoDB (key-value, document) or Amazon DocumentDB (MongoDB-compatible)Known access patterns, huge scaleDynamoDB needs a data-model rewrite; no SQL joins; capacity and indexes are designed up front
Blob StorageAmazon S3Documents, statements, backups, data lakeDifferent access control model; see below
Azure FilesAmazon FSx for Windows File Server (SMB) or Amazon EFS (NFS)SMB shares for Windows appsFSx is billed for capacity and throughput even when idle
Azure Cache for RedisAmazon ElastiCache for Valkey (or Redis OSS), MemoryDB for durable Redis-compatible dataSession and rate cachesCache nodes live in your VPC; no public endpoint by default
Synapse, Data FactoryRedshift, Athena, GlueAnalytics and ETLCovered in Module 7

Babelfish: what it is and what it is not

Babelfish for Aurora PostgreSQL adds a SQL Server wire-protocol (TDS) endpoint and T-SQL support to Aurora PostgreSQL, so many SQL Server applications connect with little or no code change. It is not a magic converter. Features such as SQL CLR, SSIS, linked servers and some data types or system procedures are partly or wholly unsupported, and behaviour in edge cases (collation, error numbers, isolation details) can differ. AWS provides Babelfish Compass, a free assessment tool that scans your DDL and captured queries and reports unsupported constructs; use it before deciding (Babelfish overview). Version numbers and feature coverage move quickly, so check the current Babelfish release notes ⚠ VERIFY.

Decision shortcut for Harbourline:

  1. Compass report clean and the team accepts a PostgreSQL operational skill set → Aurora PostgreSQL with Babelfish, then converge gradually to native PostgreSQL.
  2. Compass report shows CLR, SSIS or linked servers in use → RDS for SQL Server (or SQL Server on EC2 if even RDS blocks you).
  3. You want a full rewrite to PostgreSQL → use DMS Schema Conversion (a later lesson in this module) and plan an EF Core provider change.

Microsoft / Azure comparison

You know (Azure)AWS equivalentWhat's different
Azure AD authentication to SQLWindows authentication via AWS Managed Microsoft AD (Kerberos) for RDS for SQL ServerIAM database authentication is not the SQL Server mechanism; plan AD integration (identity lesson)
Authentication=Active Directory Default in the connection stringSQL logins with a password in Secrets Manager (with rotation), or Windows authThere is no managed-identity-to-SQL flow on RDS for SQL Server; Aurora PostgreSQL does support IAM database authentication on its PostgreSQL endpoint
Automated backups with PITRRDS automated backups and point-in-time restore; Aurora continuous backupRetention up to 35 days; cross-Region copies are a separate setting
Active geo-replication, failover groupsRDS Multi-AZ (SQL Server uses Always On or mirroring depending on edition ⚠ VERIFY), cross-Region read replicas (edition dependent), Aurora Global DatabaseReplica features depend on engine and edition; verify before promising an RPO
Long-term retention backupsAWS Backup vaults and snapshots with lifecycle rulesUse Vault Lock for immutability
BACPAC import/exportNative backup and restore of .bak files through S3 (RDS option group SQLSERVER_BACKUP_RESTORE)The fastest like-for-like seed for RDS for SQL Server (database migration)
Blob container (private, public, blob)Bucket with Block Public Access onThere are no "container access levels"; objects are private unless a policy says otherwise
Shared access signature (SAS)Presigned URL (or CloudFront signed URL)A presigned URL carries the signer's permissions and expires; it is not a separately scoped credential
Blob access tiers (Hot, Cool, Cold, Archive)S3 storage classes (Standard, Standard-IA, Glacier tiers, Intelligent-Tiering) plus lifecycle rulesRetrieval times, minimum durations and fees differ; model them before moving cold data
Soft delete for blobsS3 Versioning (and a lifecycle rule to expire noncurrent versions)Versioning must be enabled before you need it
Immutable blob storage (WORM)S3 Object Lock (compliance or governance mode)Object Lock needs versioning; compliance mode cannot be shortened by anyone, including the root user. Turn it on before the first record lands, because earlier objects carry no retention
Cosmos DB RU/s, partition keyDynamoDB read/write capacity (on-demand or provisioned), partition key and sort keyHot partitions hurt both; item size limit is 400 KB ⚠ VERIFY
Change feedDynamoDB StreamsOrdered per item, 24-hour retention
RedisElastiCache for ValkeySame protocol family; check client library support and TLS settings

Architecture

Security-boundary view. Databases and caches have no public endpoints: they sit in private subnets and accept connections only from the application's security group. Encryption at rest uses a KMS key (customer managed for regulated data); connections require TLS. S3 has Block Public Access on and a bucket policy that denies non-TLS requests.

Step-by-step implementation

Inventory databases and features

For each database, list the engine version, size, growth, and the instance-level features in use: SQL Agent jobs, linked servers, CLR, SSIS, Service Broker, full-text search, cross-database queries. Query it:

-- Which SQL Agent jobs, linked servers and CLR assemblies exist?
SELECT name AS job_name FROM msdb.dbo.sysjobs;
SELECT name AS linked_server FROM sys.servers WHERE is_linked = 1;
SELECT name AS clr_assembly FROM sys.assemblies WHERE is_user_defined = 1;

Decide the relational target

Apply the shortcut above. Run Babelfish Compass for any database you might send to Aurora; record the report in the migration folder.

Fix the connection string and the credential flow

Change the server name, require encryption, and read the password from Secrets Manager at start-up (see below). Remove any Azure AD authentication mode.

Design the object storage

One bucket per data classification: Block Public Access on, default encryption with KMS, versioning on, Object Lock on for records that must be immutable, lifecycle rules for tiering, and a bucket policy that denies insecure transport.

Re-model Cosmos DB workloads

List access patterns first ("get account by ID", "transactions by account and date"), then design the DynamoDB table and indexes around them. Do not copy the document shape blindly.

Plan the cache

Choose Valkey nodes in two AZs, in-transit encryption on, auth enabled, in private subnets; update the client connection string to use TLS.

AWS Console instructions

  • RDS for SQL Server: Console → RDS → Create database → Standard create → Microsoft SQL Server, edition, version, Multi-AZ, storage encryption with a KMS key, Public access: No, and a security group allowing port 1433 only from the application's security group.
  • S3 with Object Lock: Console → S3 → Create bucket, keep Block all public access on, enable Bucket Versioning, expand Advanced settings → Object Lock → Enable. Choose it at creation: AWS can also enable Object Lock on an existing versioned bucket, but objects written earlier carry no retention lock ⚠ VERIFY the current console path for existing buckets.
  • DynamoDB: Console → DynamoDB → Create table, then Additional settings → Capacity mode.

AWS CLI

# Create a bucket the secure way: with Object Lock enabled from the start.
aws s3api create-bucket --bucket hl-m13-statements-<account-id> \
  --object-lock-enabled-for-bucket --region us-east-1 --profile learn-sandbox

# Block public access, default encryption with the AWS managed S3 key (use a customer managed KMS key in production).
aws s3api put-public-access-block --bucket hl-m13-statements-<account-id> \
  --public-access-block-configuration BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true \
  --profile learn-sandbox

aws s3api put-bucket-encryption --bucket hl-m13-statements-<account-id> \
  --server-side-encryption-configuration '{"Rules":[{"ApplyServerSideEncryptionByDefault":{"SSEAlgorithm":"aws:kms"}}]}' \
  --profile learn-sandbox

# Default retention in governance mode for a short learning period (compliance mode cannot be undone).
aws s3api put-object-lock-configuration --bucket hl-m13-statements-<account-id> \
  --object-lock-configuration '{"ObjectLockEnabled":"Enabled","Rule":{"DefaultRetention":{"Mode":"GOVERNANCE","Days":1}}}' \
  --profile learn-sandbox

# RDS: which SQL Server versions and editions exist right now in this Region?
aws rds describe-db-engine-versions --engine sqlserver-se --region us-east-1 --profile learn-sandbox \
  --query "DBEngineVersions[].EngineVersion" --output text

Infrastructure as Code

StatementsBucketStack.cs
using Amazon.CDK;
using Amazon.CDK.AWS.S3;
using Constructs;

public sealed class StatementsBucketStack : Stack
{
    public StatementsBucketStack(Construct scope, string id, IStackProps props) : base(scope, id, props)
    {
        _ = new Bucket(this, "Statements", new BucketProps
        {
            BlockPublicAccess = BlockPublicAccess.BLOCK_ALL,
            Encryption = BucketEncryption.KMS_MANAGED,
            EnforceSSL = true,
            Versioned = true,
            ObjectLockEnabled = true,
            ObjectLockDefaultRetention = ObjectLockRetention.Governance(Duration.Days(1)),
            // Learning setup: destroy on stack delete. Production keeps the bucket (RemovalPolicy.RETAIN).
            RemovalPolicy = RemovalPolicy.DESTROY,
            AutoDeleteObjects = false,
        });

        Amazon.CDK.Tags.Of(this).Add("Project", "cea-lab");
        Amazon.CDK.Tags.Of(this).Add("Lab", "m13-data");
        Amazon.CDK.Tags.Of(this).Add("Environment", "learn");
    }
}

With Object Lock, objects under retention block bucket deletion until the retention passes. That is why the lab retention is one day.

Complete code

Azure SAS versus an S3 presigned URL, and the SQL connection change. Packages: AWSSDK.S3, AWSSDK.SecretsManager, Microsoft.Data.SqlClient.

Presign.cs
using Amazon.S3;
using Amazon.S3.Model;

public static class Presign
{
    // Azure (before): BlobSasBuilder with Read permission and an expiry, signed with the account key
    // or a user delegation key. The URL carries the permissions you gave it.
    //
    // AWS (after): a presigned URL is the same HTTPS URL plus a signature made with the *caller's*
    // credentials. If the signer is an IAM role session, the URL stops working when that session expires.
    public static string StatementDownloadUrl(IAmazonS3 s3, string bucket, string key, TimeSpan lifetime)
    {
        if (lifetime > TimeSpan.FromMinutes(15))
        {
            throw new ArgumentOutOfRangeException(nameof(lifetime), "Keep statement links short-lived (15 minutes or less).");
        }

        var request = new GetPreSignedUrlRequest
        {
            BucketName = bucket,
            Key = key,
            Verb = HttpVerb.GET,
            Expires = DateTime.UtcNow.Add(lifetime),
            Protocol = Protocol.HTTPS,
        };

        return s3.GetPreSignedURL(request);
    }
}
SqlConnection.cs
using System.Text.Json;
using Amazon.SecretsManager;
using Amazon.SecretsManager.Model;
using Microsoft.Data.SqlClient;

public static class SqlConnectionFactory
{
    // The secret is JSON like {"username":"app_user","password":"..."} created by RDS or by you.
    public static async Task<SqlConnection> OpenAsync(IAmazonSecretsManager sm, string secretId, string host, string database)
    {
        var secret = await sm.GetSecretValueAsync(new GetSecretValueRequest { SecretId = secretId });
        using var doc = JsonDocument.Parse(secret.SecretString);

        var cs = new SqlConnectionStringBuilder
        {
            DataSource = $"{host},1433",
            InitialCatalog = database,
            UserID = doc.RootElement.GetProperty("username").GetString(),
            Password = doc.RootElement.GetProperty("password").GetString(),
            Encrypt = SqlConnectionEncryptOption.Mandatory,
            TrustServerCertificate = false, // validate the RDS certificate against the AWS trust bundle
            ApplicationName = "Harbourline.Ledger",
            ConnectTimeout = 15,
        };

        var conn = new SqlConnection(cs.ConnectionString);
        await conn.OpenAsync();
        return conn;
    }
}

Code explained line by line

  1. GetPreSignedUrlRequest describes the object, the HTTP verb and the expiry. Protocol.HTTPS forces TLS.
  2. The 15-minute guard turns a policy into code: a long-lived presigned URL is a leaked-document risk. An Azure SAS often lived for hours or days; do not copy that habit.
  3. GetPreSignedURL signs locally with the caller's credentials, so there is no network call and no extra service.
  4. In the SQL code, GetSecretValueAsync retrieves the credential at start-up. Cache it and refresh on rotation rather than reading per request.
  5. SqlConnectionStringBuilder avoids string concatenation mistakes. Encrypt = Mandatory and TrustServerCertificate = false ensure TLS and certificate validation; install the Amazon RDS certificate bundle on the host or container if validation fails.
  6. DataSource = host,1433 uses the comma form SQL Server expects for ports.

Security considerations

⚠ Learning shortcut — not for production

The CLI example uses governance-mode Object Lock for one day and the AWS managed key so you can clean up. A real statement archive uses compliance mode with the retention your records policy requires (set after legal sign-off, because nobody can shorten it), a customer managed KMS key with a reviewed key policy, replication to a second account for resilience, and S3 access logging or CloudTrail data events for evidence.

  • Never TrustServerCertificate=true to "make it work". Fix the certificate chain.
  • Rotate database credentials with Secrets Manager rotation, and grant the application login only the schema permissions it needs.
  • Presigned URLs bypass your API's authorisation once issued. Issue them only after your own authorisation check, keep them short and log issuance.
  • Personal data: S3 and RDS support encryption and access logging, but UK GDPR obligations (retention, erasure, subject access) remain yours. Involve your DPO for retention and Region choices. Nothing here is a compliance claim.
  • Private by default: no public RDS endpoints, no public buckets.

Banking use case

Harbourline's ledger database holds a CLR IBAN validator and linked-server queries to a risk database. Compass flags both. The team chooses RDS for SQL Server for the ledger (accepting licence-included cost, covered later), moves the CLR logic into the application (a small, tested C# service) over the next quarter, and sends the lower-risk reporting database to Aurora PostgreSQL with Babelfish. Statement PDFs go to S3 with Object Lock in compliance mode for the legally required retention, set by the records manager, with CloudFront signed URLs for customer download. Sessions go to ElastiCache for Valkey. Cosmos DB-backed notification preferences are re-modelled in DynamoDB with a single table keyed by customer.

Common mistakes

  • Choosing the target before running Compass or the feature queries. Late discovery of CLR or linked servers wrecks the plan.
  • Assuming RDS gives sysadmin. It does not; scripts that need it must change.
  • Enabling versioning or Object Lock "later". Objects written before they were enabled are unprotected, so set both up before the first file lands.
  • Copying SAS lifetimes. Hours-long presigned URLs are an exposure.
  • Porting Cosmos DB documents as-is. DynamoDB punishes query-driven modelling.
  • TrustServerCertificate=true. It disables the server identity check.

Troubleshooting

SymptomLikely causeFix
A connection was successfully established ... certificate chain was issued by an authority that is not trustedHost lacks the RDS CA bundleInstall the Amazon RDS certificate bundle for your Region; keep TrustServerCertificate=false
Cannot connect to RDS from a laptopPrivate subnets and security group allow only the appUse a bastion with SSM Session Manager or run a test from a task in the VPC
Login failed for user after restoreOrphaned database users after restoring a .bakRe-map users or create logins first
Presigned URL returns AccessDeniedSigner lacks s3:GetObject, or the session expiredUse a role with the permission and make the URL lifetime shorter than the session
InvalidBucketState on enabling Object LockVersioning is off or suspended, or the bucket state does not allow itEnable versioning first; if it still fails, create a new bucket with Object Lock and copy the data
Bucket will not deleteObjects under retentionWait for retention, or use governance mode with bypass permission in a lab

Cost and cleanup

Cost label: free for the S3 and local work in this lesson (a few cents at most for a handful of small objects; check the free tier ⚠ VERIFY). Do not create an RDS instance for this lesson: RDS for SQL Server is licence-included and billed hourly, so treat the RDS steps as design-only unless you follow the deploy-and-destroy exercise in the database migration lab later in this module. Free alternative for SQL Server practice: run SQL Server Developer or Express edition in Docker on your machine.

# Remove the lab bucket (governance retention allows bypass with the right permission)
aws s3api list-object-versions --bucket hl-m13-statements-<account-id> --profile learn-sandbox
aws s3api delete-bucket --bucket hl-m13-statements-<account-id> --profile learn-sandbox

# Verify nothing tagged for the course remains
aws resourcegroupstaggingapi get-resources --tag-filters Key=Project,Values=cea-lab \
  --profile learn-sandbox --region us-east-1 --query "ResourceTagMappingList[].ResourceARN"

If the bucket still contains locked objects, wait one day (the learning retention) and delete the versions, then the bucket.

Exercises

  • 🟢 Guided: write the SQL queries from step one against a local SQL Server container with a sample database and record which features it uses. Then say, for each feature found, whether it points to RDS for SQL Server or Babelfish.
  • 🟡 Challenge: write a table of ten Azure Blob features you rely on (tiers, lifecycle, SAS, soft delete, immutability, static website, events, private endpoints, CORS, access logs) with the S3 mechanism and one difference each. Mark unverified items ⚠ VERIFY.
  • 🔴 Live problem: the records manager says "statements must be unalterable for seven years, but customers can request erasure of personal data." Describe how Object Lock, retention, encryption key management and your legal team's role interact, and what you would ask before choosing compliance mode.

Assignment

Produce a data target matrix for three of your databases and two storage accounts: current service, features used, chosen AWS target, rejected alternative and reason, connection and credential change, backup and retention design, and a rollback note. Commit it to your portfolio repository.

Solutions

Knowledge check

Interview questions

  • "What are the first three things you check before choosing RDS or Aurora Babelfish?" Instance-level features (CLR, linked servers, SSIS, SQL Agent), the Compass report, and the team's skills and tooling for PostgreSQL.
  • "How do you keep statement files immutable on AWS?" S3 with versioning and Object Lock in compliance mode for regulatory retention, a customer managed key, and replication to a separate account.
  • "What changes in the .NET connection string?" Host name, mandatory encryption with certificate validation, and credentials from Secrets Manager instead of Azure AD or managed identity.

Certification practice

Completion checklist

  • I can state which SQL Server features push a database to RDS rather than Babelfish
  • I can write a presigned URL and justify its lifetime
  • I know Object Lock must be on before the first record is written
  • I deleted any bucket I created and ran the tag query

Key takeaways

  • Instance-level features (CLR, linked servers, SSIS) decide the SQL Server target, not table count.
  • Babelfish helps compatible T-SQL applications; Compass tells you whether yours qualifies.
  • Presigned URLs replace SAS but carry the signer's permissions; keep them short.
  • Object Lock and versioning must be planned before the first record lands.
  • Cosmos DB to DynamoDB is a re-model, not a port.

Further reading

Independent learning resource — not affiliated with, endorsed or sponsored by Amazon Web Services. AWS and related marks are trademarks of Amazon.com, Inc. or its affiliates. All banking data in examples is fictional. Sample architectures are for learning and are not automatically compliant with GDPR, PCI DSS or any banking regulation.

On this page