Cost and cross-cloud migration
Cost and cross-cloud migration
Cloud cost and migration decisions need explicit units, assumptions, recovery objectives and a safe exit plan.
Estimate compute, minimum replicas, requests, database capacity and I/O, storage, backup retention, egress, messaging, load balancers, public IP/NAT and observability ingestion separately. Billing units vary by provider and plan; idle capacity, cold-start mitigation, cross-zone transfer and duplicate environments can dominate. Use vendor calculators with a specific region, currency, SKU, license, quota and date only after the deployment scope is approved. No current prices are supplied; examples use invented accounting units, not dollars or vendor quotes. Budgets alert but do not inherently stop consumption. Define recovery point objective (maximum acceptable lost data interval) and recovery time objective (maximum tolerable recovery duration), and prove them with restore drills. Data residency includes backups, logs, support access and replicated copies, not just the application region. Portable application code and OCI images do not make SQL dialects, queue semantics, identity or infrastructure definitions portable. Maintain data export and reconciliation, a staged cutover, a write-fencing plan, and a rollback window with old/new schema compatibility. Do not switch writes to two systems without a consistency design. A cloud teardown checklist identifies owned resources, confirms dependencies and retention requirements, deletes only approved resources, verifies inventory, and revisits billing for delayed or residual charges. Never assume deleting one resource group removes every external charge.
Baseline: .NET 10 / C# 14. All C# results below are reasoned, not executed. Synthetic calculations are not vendor quotes or production measurements.
Calculate a synthetic monthly cost
All rates are arbitrary accounting units, not actual cloud prices.
Inspect the archived Fixture.csproj and use only an approved .NET 10 SDK. Build and run in an isolated lab with finite time and resource limits.
using System;using System.Globalization;decimal compute = 120m * 0.2m, storage = 40m * 0.1m, egress = 15m * 0.5m, fixedDb = 30m;decimal total = compute + storage + egress + fixedDb;Console.WriteLine(total.ToString("0.00", CultureInfo.InvariantCulture));Console.WriteLine((total+10m).ToString("0.00", CultureInfo.InvariantCulture));Expected result (not executed):
65.5075.50The second scenario adds an observability allowance. Real estimates need unit-specific provider rates and usage ranges.
Check recovery objectives from a synthetic drill
Both data loss and recovery duration must meet the chosen objective.
Inspect the archived Fixture.csproj and use only an approved .NET 10 SDK. Build and run in an isolated lab with finite time and resource limits.
using System;static bool Meets(int lostMinutes,int recoveryMinutes) => lostMinutes >= 0 && recoveryMinutes >= 0 && lostMinutes <= 15 && recoveryMinutes <= 60;foreach (var drill in new[]{(5,45),(20,45),(5,75),(15,60)}) Console.WriteLine(Meets(drill.Item1,drill.Item2)?"pass model":"fail model");Expected result (not executed):
pass modelfail modelfail modelpass modelA theoretical backup interval alone does not establish observed recoverability. Test the complete restore, verification and traffic recovery path.
Reconcile a migration before switching writes
Compare keys and values, not just row counts.
Inspect the archived Fixture.csproj and use only an approved .NET 10 SDK. Build and run in an isolated lab with finite time and resource limits.
using System;using System.Collections.Generic;using System.Linq;var old = new Dictionary<string,int>{{"A",3},{"B",4}};foreach (var next in new[]{new Dictionary<string,int>{{"A",3},{"C",4}},new Dictionary<string,int>{{"A",3},{"B",4}}}) { bool match=old.Count==next.Count && old.All(p=>next.TryGetValue(p.Key,out int n)&&n==p.Value); Console.WriteLine(match?"matched sample":"block cutover");}Expected result (not executed):
block cutovermatched sampleUse a consistent snapshot, reconcile relationships and change capture, fence writes and check rollback feasibility. A match for two rows is not production evidence.
Apply the concept
Plan a migration from Azure PostgreSQL and Service Bus to an alternative cloud. Provide low/base/high cost dimensions and a teardown plan.
Use the manual practice and knowledge check. Do not deploy or publish these fixtures.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Cost and cross-cloud migration — knowledge check
Apply the lesson concepts to the following scenarios.
Does an Azure budget automatically stop all resources?
What is the RPO concerned with?
Why is equal row count insufficient for migration?
Which cost can remain after a compute instance is removed?
What is not guaranteed by portable containers?