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

Lab 13.1: classify an estate with the 7 Rs

Run and extend a tested C# rule engine that classifies a fifteen-component bookshop estate (modelled on a classic .NET Framework and SQL Server monolith) into the seven migration strategies, groups chatty components into waves, and prints a change-board report, with no AWS account.

intermediate⏱ 1 h 30 min🟢 FreeSAP-C03SAA-C03

Assumes: .NET 10 LTS · xUnit v3 4.0.3 on Microsoft.Testing.Platform · Docker · labs/m13-migration-classifier. Verified against official sources on 2026-11-18.

Learning objectives

By the end of this lab you can:

  • Run the classifier and read each recommendation, its effort size, confidence and reasons.
  • Explain why a component was classified Retire, Retain, Relocate, Repurchase, Rehost, Replatform or Refactor, using the evidence in the inventory.
  • Change a rule or a blocker weight and prove the change with a test.
  • Read a wave plan and explain why a group of three components moves together in the last wave.
  • Turn the tool's Markdown report into a change-board attachment.

Prerequisites

  • The 7 Rs of migration, which explains the rules this lab encodes
  • Docker Desktop (or the .NET 10 SDK installed locally)
  • No AWS account, credentials or cloud resources are needed

Cost label

Free. Everything runs on your machine. Nothing is created in AWS, so there is nothing to bill and nothing to destroy.

Scenario

Harbourline Bank acquired a small online bookshop, and its estate is the practice ground for the real migration. The bookshop is a classic ASP.NET MVC and Web Forms monolith on .NET Framework with SQL Server, a Windows service using MSMQ, a file share of cover images, a vendor CRM, and a VMware VM in the warehouse. The change board has asked for one recommendation per component, with the evidence, plus a first wave plan. You will use the lab's classifier to produce it and then challenge its rules.

The inventory is fictional. It is modelled on the shape of the public aws-samples/bobs-used-bookstore-classic sample (a good real target for the later porting and database labs in this module), but it is not a copy of that sample. ⚠ VERIFY the real sample's component list before quoting it.

Architecture

The files

PathWhat it does
src/Harbourline.Migration.Assessment/Model.csAppComponent, the enums for kind and strategy, and the Recommendation record
.../Blockers.csKnown porting blockers and their weights; the "hard" and "SQL Server engine only" sets
.../Classifier.csThe ordered rule list; the policy lives here
.../WavePlanner.csUnion-find over chatty dependencies, ordering by risk, wave chunking, warnings
.../InventoryLoader.csJSON loading and validation (duplicates, unknown dependencies, criticality range)
.../MarkdownReport.csThe change-board report
src/Harbourline.Migration.Tools/Program.csConsole entry point
tests/Harbourline.Migration.Tests61 tests over rules, loader and waves
data/bookstore-inventory.jsonThe sample estate
docs/sample-report.mdThe expected report for --today 2026-11-18

Part A: run it and read the answer

Run the tests

From the repository root:

MSYS_NO_PATHCONV=1 docker run --rm --memory 3g \
  -v "$PWD/labs/m13-migration-classifier:/src" \
  -v cea-nuget-m13:/root/.nuget/packages \
  -w /src mcr.microsoft.com/dotnet/sdk:10.0 \
  sh -c "dotnet test --solution MigrationClassifier.slnx; find . -type d \( -name bin -o -name obj \) -prune -exec rm -rf {} +"

Expected: Test run summary: Passed! with total: 61. The named volume cea-nuget-m13 keeps the NuGet cache so a second run is fast.

MSYS_NO_PATHCONV=1 docker run --rm --memory 3g \
  -v "$PWD/labs/m13-migration-classifier:/src" \
  -v cea-nuget-m13:/root/.nuget/packages \
  -w /src mcr.microsoft.com/dotnet/sdk:10.0 \
  sh -c "dotnet run --project src/Harbourline.Migration.Tools -- data/bookstore-inventory.json --today 2026-11-18 --out docs/my-report.md; find . -type d \( -name bin -o -name obj \) -prune -exec rm -rf {} +"

Open labs/m13-migration-classifier/docs/my-report.md and compare it with docs/sample-report.md. Pin --today: the decommission rule uses the date, so unpinned runs drift.

Read the summary

The sample estate yields: Retire 2, Retain 2, Relocate 1, Repurchase 1, Refactor 2, Replatform 5, Rehost 2. Every one of the seven strategies appears, which is deliberate: a test asserts it so the sample keeps teaching all seven.

Explain three decisions in your own words

Pick web-admin (Replatform despite high activity), db-reporting (Replatform to RDS, not Babelfish) and job-ftp-export (Retain). For each, write the evidence from the inventory and the rule that fired. If you cannot, read the Why column and the matching branch in Classifier.cs.

Part B: change a rule, prove it with a test

The classifier's rule order is the policy. Here is the .NET Framework branch you will modify:

Classifier.cs (DecideCode, the .NET Framework part)
var strategic = c.ChangesLast12Months >= StrategicChangeThreshold;
var hard = c.Blockers.Where(Blockers.Hard.Contains).ToList();

if (!strategic)
{
    reasons.Add($"Few changes in the last year ({c.ChangesLast12Months}): rewriting returns little. Rehost to EC2 Windows with AWS Application Migration Service, modernise opportunistically.");
    return MigrationStrategy.Rehost;
}

if (hard.Count > 0 || points > RefactorMaxPoints)
{
    var hardText = hard.Count > 0 ? $" including hard blockers ({string.Join(", ", hard)})" : "";
    reasons.Add($"Strategic, but {points} blocker points{hardText}: stay on .NET Framework for now (replatform onto Windows hosting), then strangle pieces out to .NET 10 over time.");
    return MigrationStrategy.Replatform;
}

reasons.Add($"Strategic and portable ({points} blocker points, none hard): refactor to .NET 10 and containers.");
return MigrationStrategy.Refactor;

Experiment 1: edit data/bookstore-inventory.json and set web-admin's changesLast12Months to 2. Predict the new strategy, then re-run. It becomes Rehost, because a rarely changed app does not justify a rewrite. Change it back.

Experiment 2: lower RefactorMaxPoints from 12 to 8 and run the tests. Sample_components_get_the_expected_strategy fails for web-storefront (9 points) and svc-order-processing (10 points), which now become Replatform. That failure is the test doing its job: it forces you to decide whether the new threshold is a deliberate policy change. If it is, update the expected values and write the reason in your pull request. Then revert.

Experiment 3: add a blocker. In Blockers.cs add public const string Biztalk = "Biztalk"; and [Biztalk] = 7, to the weights. Add a test:

ClassifierTests.cs (new test)
[Fact]
public void Biztalk_counts_seven_points()
{
    Assert.Equal(7, Blockers.WeightOf("Biztalk"));
}

Note that an unknown blocker name works too: it counts two points and lowers confidence to Medium. A known name is better because it carries the right weight.

Part C: read the wave plan

WavePlanner unions components joined by chatty dependencies, so they land in the same move group:

WavePlanner.cs (the grouping step)
foreach (var r in moving)
{
    foreach (var dep in r.Component.DependsOn.Where(d => d.Chatty))
    {
        if (parent.ContainsKey(dep.TargetId))
        {
            parent[Find(r.Component.Id)] = Find(dep.TargetId);
            continue;
        }
        // ...warn when the chatty target stays on-premises or is being retired
    }
}

In the sample, web-storefront and svc-order-processing both talk chattily to db-bookstore, so the three form one group with risk 4 (the highest criticality among them) and move in the last wave. The first wave is the book-cover file share (risk 1) and the reporting database (risk 2), the forgiving pair the team learns on.

The report also prints a warning: vm-warehouse-gateway talks chattily to the label printer manager, which is retained on-premises. That is exactly the situation where a VPN or Direct Connect latency test must pass before the VM moves.

Security considerations

⚠ Learning shortcut — not for production

The inventory is hand-written fictional data, the weights are teaching values, and the tool trusts the file. A real programme builds the inventory from discovery data, has application owners and security review each row, and stores the report with access control because it reveals dependencies and weaknesses. Never paste a real inventory into a public repository or an AI chat tool.

  • Fictional data only. The components, users and dates here are invented.
  • Evidence, not opinions. Each reason string states the rule that fired; keep that habit in real change documents.
  • Personal data flag. containsPersonalData adds a data-protection review reason on databases. In a real programme, involve your DPO for anything that changes processor or location. This lab makes no legal claim.

Common mistakes

  • Editing a threshold and fixing the failing test without thinking. The failure is the review prompt. Write down why the policy changed.
  • Using today's real date without --today. Results then change as the calendar moves.
  • Marking every dependency as chatty. Everything glues into one huge group and the plan has a single giant wave. Reserve chatty for latency-sensitive calls.
  • Leaving usage null for web applications. Confidence drops to Low; measure it.
  • Misspelling a blocker. It counts two points and lowers confidence. Use the names in Blockers.cs.

Troubleshooting

SymptomLikely causeFix
Inventory is not valid: ...JSON syntax error or an unknown kindCheck the commas, and use a valid kind name
depends on unknown componentA targetId that is not an idFix the spelling
Duplicate component idTwo rows share an id (case-insensitive)Rename one
Test cannot find the data fileThe data file was movedIt is linked into the test output by the test .csproj; keep it at data/bookstore-inventory.json
Docker cannot mount the folderPath conversion in Git BashKeep MSYS_NO_PATHCONV=1 and quote the path
Slow first runNuGet restore into the empty volumeRe-run; the cache then persists

Cost and cleanup

Nothing was created in AWS. Delete labs/m13-migration-classifier/docs/my-report.md if you do not want to keep it, and remove build output:

find labs/m13-migration-classifier -type d \( -name bin -o -name obj -o -name TestResults \) -prune -exec rm -rf {} +
# Optional: free the disk used by the NuGet cache volume
docker volume rm cea-nuget-m13

Exercises

  • 🟢 Guided: run Experiments 1 and 2, and write two sentences on what each taught you about the rule order.
  • 🟡 Challenge: add a new component svc-statement-generator (kind BackgroundService, .NET Framework 4.8, criticality 3, 12 changes a year, blockers ComInterop and LocalFileState, depends chattily on db-bookstore). Predict its strategy and wave, then check. Add a test that locks the result.
  • 🔴 Live problem: the head of operations says "everything in wave 5 must move before the Christmas trading freeze in six weeks, no exceptions." Using the plan, state which components are actually on the critical path, which risks you would raise (the shared database with the chatty group, the Windows hosting questions), and what you would offer instead (for example move the read-only pieces early).

Assignment

Replace the sample inventory with ten components from your own organisation (anonymised) or from Harbourline's three-application portfolio in the module assignment. Produce the report, add two tests for decisions you disagree with, and write a short note naming the three components whose classification most needs human review, and why.

Solutions

Knowledge check

Interview questions

  • "How would you make a migration classification defensible to an auditor?" Make every recommendation carry its rule and evidence, keep the rules in version control with tests, and record human overrides with a reason and an approver.
  • "Why keep the rules in code instead of a spreadsheet?" Tests catch silent policy changes, results are repeatable, and reviews happen in pull requests.

Certification practice

Completion checklist

  • I ran the 61 tests and saw them pass
  • I printed the report and explained three decisions
  • I changed a rule or weight and proved it with a test
  • I read the wave plan and the on-premises latency warning
  • I removed bin/ and obj/ folders

Key takeaways

  • The rule order is the policy; tests keep it honest.
  • Every recommendation carries a reason and a confidence, which is what a change board reads.
  • Hard blockers, change rate and source availability decide Refactor, Replatform or Rehost for .NET code.
  • Chatty dependencies form move groups; the riskiest group moves last.
  • No AWS account is needed to plan a migration well.

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