📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

πŸ“š Interview question

Your CTO wants the new .NET 10 platform to be multi-cloud, running on both Azure and AWS, "to avoid lock-in". How do you evaluate that? When should a .NET team avoid multi-cloud, what does it really cost, and if you stay on one cloud, how do you keep the code portable enough that a future move is realistic?

Architecture question on multi-cloud for .NET teams: the variants (active-active, cloud-per-workload, portable single cloud), real costs (lowest common denominator, egress, skills, security surface), when to avoid it, and how to keep code portable with ports and adapters, containers, OpenTelemetry, Terraform and exit plans.

Senior Architecture Advanced architecture aws azure devops multi-cloud portability

🎯 Key points

  • Clarify the driver first: lock-in fear, resilience, regulation (APRA CPS 230 operational resilience), M&A or customer demand
  • Distinguish active-active multi-cloud, workload-per-cloud, and single cloud with a tested exit plan
  • Costs: lowest-common-denominator services, double skills and on-call, egress charges, two IAM and network models, more attack surface
  • Multi-region on one cloud (Australia East / Southeast, Sydney / Melbourne) usually beats multi-cloud for availability and keeps data onshore for APP 8 and government residency rules
  • Organisational cost: training, platform ownership, two runbooks and on-call rotations, team capacity taken from features
  • Portability where it is cheap: containers, OpenTelemetry, standard protocols (HTTP, AMQP, Kafka), PostgreSQL or SQL Server
  • Ports and adapters: thin interfaces owned by the domain, cloud SDKs only in adapters, contract tests against Azurite and LocalStack
  • Record each lock-in in an ADR with an exit cost, and prove it with Terraform/OpenTofu and a periodic portability drill

⏱ 30-second answer

I'd start with why. "Avoid lock-in" is a fear, not a requirement. Real drivers are regulatory resilience (for example APRA CPS 230), a customer or acquisition on the other cloud, or a service only one cloud has.

Most .NET teams should avoid active-active multi-cloud:

  • It forces the lowest common denominator of services.
  • It doubles skills, on-call and security surface.
  • It adds egress costs.

For availability, multi-region on one cloud (Australia East and Southeast, or Sydney and Melbourne) is cheaper and more reliable.

What I'd do is portable by design, single cloud in practice: containers, OpenTelemetry, standard protocols, ports and adapters with cloud SDKs only in adapters, Terraform, and an ADR that records each lock-in and its exit cost.

The trade-off: you buy optionality with complexity, so buy only as much as the business will pay for.

πŸ—£ Full answer (senior)

How I would answer this in an interview

"I wouldn't say yes or no straight away. I'd ask what problem multi-cloud is meant to solve, because the answer changes the design. If it's fear of lock-in, the cheapest protection is portability and an exit plan, not running everything twice. If it's resilience, multi-region on one cloud usually gives more availability for much less effort. If it's regulation, say APRA CPS 230 expectations on operational resilience and material service providers, the regulator wants a credible, tested plan for a provider failure, which can be met without active-active. And if it's a customer or an acquired company on AWS, a workload-per-cloud split may be the honest answer.

For example, at [company] we were asked to [run the platform on both Azure and AWS]. I [estimated the cost of building and operating both], and the numbers were clear: [two IAM models, two network designs, double on-call, data egress of around $X a month, and we'd lose Service Bus sessions and Cosmos DB features we relied on]. We instead [stayed on Azure across Australia East and Southeast], kept the services in containers with OpenTelemetry, put storage, messaging and secrets behind interfaces owned by the domain, and wrote the infrastructure in Terraform. Then we [ran a portability drill, deploying one service to AWS in N days]. That gave leadership a measured exit cost instead of a fear.

The mistake I see is building an abstraction over every cloud service 'just in case'. You end up with a worse version of both clouds and still can't move, because the real lock-in is the data, the identity model and the operations knowledge, not the SDK calls. I'd rather use managed services fully, record each lock-in in an ADR with what leaving would cost, and keep the code portable where it's cheap."


The three things people mean by multi-cloud

Variant What it is Typical driver Cost
Active-active across clouds Same workload live on Azure and AWS Extreme availability claims, regulatory pressure Very high: duplicated everything, data sync, lowest common denominator
Workload per cloud Different systems on different clouds Acquisitions, best-of-breed services, customer location Medium: two platforms, but each workload uses its cloud fully
Single cloud, portable, exit plan One cloud, designed to move if needed Lock-in risk, negotiating leverage Low: discipline and a periodic drill

What multi-cloud really costs

Cost Why
Lowest common denominator You avoid Service Bus sessions, Cosmos DB, Step Functions, DynamoDB, because the other side lacks them
Skills and on-call Engineers must know two IAM models, two network models and two sets of failure modes
Security surface Two identity systems, two sets of policies, two audit trails to monitor (Essential Eight applies to both)
Egress Moving data between clouds is charged per GB in both directions of a sync
Data consistency Cross-cloud replication of a relational database is hard; one side is usually primary anyway
Tooling Two IaC providers, two monitoring stacks unless you standardise

Where portability is cheap, and where it isn't

Layer Cheap to keep portable Expensive to keep portable
Compute Containers (OCI images), Kubernetes or plain container platforms Functions with cloud-specific triggers and bindings
Data SQL Server or PostgreSQL, EF Core Cosmos DB, DynamoDB, proprietary query languages
Messaging AMQP, Kafka, abstraction over send/receive Sessions, filters, scheduled messages, EventBridge rules
Observability OpenTelemetry SDK and OTLP Vendor agents and proprietary APIs
Identity OIDC for users Workload identity (managed identity vs IAM roles) is always cloud-specific
IaC Terraform / OpenTofu (same tool, different providers) Bicep or CloudFormation (one cloud each)

Production example

A team asked to go active-active estimated [2.3x] infrastructure cost and [two extra engineers] for operations. They chose Azure across two Australian regions with a quarterly portability drill instead: deploying their order service to AWS ECS took [3 days], with the adapter swap and Terraform module changes measured and recorded in an ADR. Availability over the next year was [99.97%], above the SLO, at about [40%] of the multi-cloud estimate.

πŸ” What the interviewer is checking

Checks whether the candidate can turn a fashionable mandate into a priced, risk-based decision and still keep .NET code reasonably portable.

Green flags

  • Asks what problem multi-cloud solves and distinguishes the variants
  • Names concrete costs: lowest common denominator, skills, security surface, egress, data sync
  • Prefers multi-region on one cloud for availability, and knows the Australian regions
  • Describes ports and adapters, OpenTelemetry, containers, Terraform, ADRs and a tested exit plan

Red flags

  • "Kubernetes makes us cloud-agnostic" with no caveats
  • Abstracts every SDK by default
  • Agrees to active-active without discussing data consistency or cost

πŸ“š Learn in depth

1. Start from the requirement, not the architecture

Turn "avoid lock-in" into questions you can answer with numbers:

  • What failure are we protecting against? A region outage, a whole-provider outage, a commercial dispute, a sanctions or legal event?
  • What is the recovery objective? RTO and RPO per system.
  • What does it cost to leave today? Engineering weeks, data transfer, retraining, contract terms.
  • Who is asking, and why? Board risk committee, regulator, a big customer, procurement wanting leverage.

Whole-provider, all-region outages are rare; region and service outages are much more common and are solved inside one cloud.

2. Availability maths

Multi-cloud active-active only helps if the failover machinery itself is reliable. The extra moving parts (cross-cloud data replication, global DNS or traffic managers, two deployment pipelines) are new failure sources:

Single cloud, two regions:
  users ─▢ Front Door / Route 53 ─┬─▢ Australia East  (primary)
                                  └─▢ Australia Southeast (secondary, geo-replicated DB)

Multi-cloud active-active:
  users ─▢ third-party global DNS ─┬─▢ Azure Australia East ─┐
                                  └─▢ AWS Sydney          ─┴─ cross-cloud data sync (custom, eventual)

The second picture needs conflict handling for writes on both sides, or a single primary database, in which case one cloud is still a single point of failure for writes.

3. Ports and adapters for cloud services

Keep cloud SDKs at the edge. The domain owns small interfaces shaped by what it needs, not by what one SDK exposes:

Domain / Application ──uses──▢ IDocumentStore, IMessagePublisher, ISecretProvider
                                        β–²             β–²              β–²
Adapters (one project per cloud):  BlobDocumentStore  ServiceBusPublisher  KeyVaultSecrets
                                   S3DocumentStore    SnsPublisher         SecretsManagerSecrets

Rules: interfaces are narrow (no GetBlobContainerClient leaking out), cloud types never appear in the domain, and each adapter has the same contract tests run against the real service or an emulator (Azurite, LocalStack) so a swap is verified.

Don't abstract what you would never move, and don't abstract features you deliberately use from one cloud. Record those in an ADR.

4. The real lock-in is not the SDK

Lock-in Why it's sticky Mitigation
Data gravity Terabytes and egress fees; live migration needs replication Open formats, standard engines, documented export
Identity Managed identity vs IAM roles, Entra ID vs IAM Identity Center Federate users with OIDC; workload identity is per cloud by nature
Networking and security Private endpoints vs PrivateLink, NSGs vs security groups IaC modules per cloud with the same intent
Operations knowledge Runbooks, dashboards, on-call habits OpenTelemetry, cloud-neutral runbook structure
Contracts Committed spend, reserved instances, enterprise agreements Align commitments with the exit horizon

5. Australian considerations

Both clouds have two Australian regions (Azure Australia East and Southeast, plus Australia Central for government; AWS Sydney and Melbourne), so data residency rarely forces multi-cloud. For APRA-regulated entities, CPS 230 (in force since 1 July 2025) expects management of material service provider risk and credible business continuity, including plans for a provider becoming unavailable. That is usually met with documented, tested exit and continuity plans, not by running everything on two providers. Government workloads look for IRAP-assessed services, and both providers have IRAP assessments covering many services.

6. A portability drill

Once or twice a year, pick one representative service and deploy it to the other cloud: build the image, swap the adapters, apply the Terraform module, run the contract and smoke tests, and measure the days spent. Put the result in the ADR. That converts "we could move" into evidence.

Try it yourself

  1. Write an ADR for one managed service you depend on (for example Service Bus sessions) with the exit cost in engineer-days.
  2. Define IDocumentStore and implement it twice, with Azurite and LocalStack, then run the same xUnit contract tests against both.
  3. Instrument a small API with OpenTelemetry and export OTLP to a local collector, then point the collector at Azure Monitor and at CloudWatch / X-Ray without changing app code.
  4. Estimate egress cost for syncing 500 GB a month between clouds using both providers' pricing calculators.
  5. Deploy the same container image to Azure Container Apps and AWS ECS Fargate with Terraform and note every difference you had to handle.

πŸ’» Code

Ports and adapters: the domain depends on a narrow interface; each cloud gets an adapter selected at start-up, and both pass the same contract tests.

// Orders.Application/Ports/IDocumentStore.cs: shaped by what the domain needs, not by an SDK.
namespace Orders.Application.Ports;

public interface IDocumentStore
{
    Task SaveAsync(string key, Stream content, string contentType, CancellationToken ct);
    Task<Stream?> OpenAsync(string key, CancellationToken ct);
}
// Orders.Infrastructure.Azure/BlobDocumentStore.cs and Orders.Infrastructure.Aws/S3DocumentStore.cs
using Amazon.S3;
using Amazon.S3.Model;
using Azure.Storage.Blobs;
using Azure.Storage.Blobs.Models;
using Orders.Application.Ports;

namespace Orders.Infrastructure;

public sealed class BlobDocumentStore(BlobContainerClient container) : IDocumentStore
{
    public async Task SaveAsync(string key, Stream content, string contentType, CancellationToken ct) =>
        await container.GetBlobClient(key).UploadAsync(content,
            new BlobUploadOptions { HttpHeaders = new BlobHttpHeaders { ContentType = contentType } }, ct);

    public async Task<Stream?> OpenAsync(string key, CancellationToken ct)
    {
        var blob = container.GetBlobClient(key);
        return await blob.ExistsAsync(ct) ? await blob.OpenReadAsync(cancellationToken: ct) : null;
    }
}

public sealed class S3DocumentStore(IAmazonS3 s3, string bucket) : IDocumentStore
{
    public Task SaveAsync(string key, Stream content, string contentType, CancellationToken ct) =>
        s3.PutObjectAsync(new PutObjectRequest
            { BucketName = bucket, Key = key, InputStream = content, ContentType = contentType }, ct);

    public async Task<Stream?> OpenAsync(string key, CancellationToken ct)
    {
        try
        {
            var response = await s3.GetObjectAsync(bucket, key, ct);
            return response.ResponseStream;
        }
        catch (AmazonS3Exception ex) when (ex.StatusCode == System.Net.HttpStatusCode.NotFound)
        {
            return null;
        }
    }
}
// Program.cs: the cloud is a deployment choice. Identity stays platform-native on both (no keys).
using Azure.Identity;
using Azure.Storage.Blobs;
using Amazon.S3;
using Orders.Application.Ports;
using Orders.Infrastructure;

var builder = WebApplication.CreateBuilder(args);

switch (builder.Configuration["Cloud"])
{
    case "Azure":
        builder.Services.AddSingleton(_ => new BlobContainerClient(
            new Uri(builder.Configuration["Documents:ContainerUri"]!), new DefaultAzureCredential()));
        builder.Services.AddSingleton<IDocumentStore, BlobDocumentStore>();
        break;
    case "Aws":
        builder.Services.AddDefaultAWSOptions(builder.Configuration.GetAWSOptions());
        builder.Services.AddAWSService<IAmazonS3>();
        builder.Services.AddSingleton<IDocumentStore>(sp => new S3DocumentStore(
            sp.GetRequiredService<IAmazonS3>(), builder.Configuration["Documents:Bucket"]!));
        break;
    default:
        throw new InvalidOperationException("Set Cloud to Azure or Aws."); // fail fast at start-up
}

// Observability is portable: OpenTelemetry with OTLP; the collector decides where it goes.
builder.Services.AddOpenTelemetry()
    .WithTracing(t => t.AddAspNetCoreInstrumentation().AddHttpClientInstrumentation().AddOtlpExporter());

var app = builder.Build();
app.Run();
// Contract tests: the same behaviour is verified against Azurite and LocalStack (xUnit).
using System.Text;
using Orders.Application.Ports;
using Xunit;

namespace Orders.ContractTests;

public abstract class DocumentStoreContract
{
    protected abstract IDocumentStore CreateStore();

    [Fact]
    public async Task Saved_document_can_be_read_back()
    {
        var store = CreateStore();
        var key = $"invoices/{Guid.NewGuid()}.txt";
        await store.SaveAsync(key, new MemoryStream(Encoding.UTF8.GetBytes("hello")), "text/plain", CancellationToken.None);

        await using var stream = await store.OpenAsync(key, CancellationToken.None);
        Assert.NotNull(stream);
        Assert.Equal("hello", await new StreamReader(stream).ReadToEndAsync());
    }

    [Fact]
    public async Task Missing_document_returns_null() =>
        Assert.Null(await CreateStore().OpenAsync("missing/key", CancellationToken.None));
}

⚠ Common mistakes

  • Mistake: Accepting "avoid lock-in" as the requirement. Why it is wrong: It hides the real driver, so you can't size the solution or say when it's done. Instead: Ask which failure or risk it protects against, with RTO, RPO and exit-cost targets.
  • Mistake: Going active-active across clouds for availability. Why it is wrong: Cross-cloud data sync and global failover add failure modes, and a single primary database keeps one cloud critical anyway. Instead: Use multi-region on one cloud with tested failover.
  • Mistake: Choosing a second cloud's region without checking data residency. Why it is wrong: Government data classified under the PSPF and contracts with onshore clauses, plus APP 8 accountability for overseas disclosure, can rule out regions or services that aren't IRAP-assessed. Instead: Keep both sides in Australian regions (Azure Australia East/Southeast/Central, AWS Sydney/Melbourne) and check each service's IRAP coverage before you design around it.
  • Mistake: Wrapping every cloud SDK in a generic abstraction. Why it is wrong: You get the lowest common denominator, lose useful features and still can't move, because data and identity are the real lock-in. Instead: Abstract only the narrow ports the domain needs, and record deliberate lock-in in ADRs.
  • Mistake: Ignoring egress charges. Why it is wrong: Replicating data or calling across clouds is billed per GB and can dominate the bill. Instead: Estimate data flows first; keep chatty services and their data on the same cloud.
  • Mistake: Adding a second cloud without adding people, training or a platform owner. Why it is wrong: The same team now carries two IAM models, two networks, two sets of runbooks and two on-call skill sets, so feature delivery slows and incidents take longer. Instead: Plan the training, name an owner per platform, budget the capacity in the roadmap, or don't add the cloud.
  • Mistake: Deciding multi-cloud in a leadership meeting and telling engineering afterwards. Why it is wrong: The people who carry the operational cost never get to price it, and the plan rests on assumptions nobody has tested. Instead: Run a short, time-boxed spike with the teams, share the cost and risk options openly, and record the decision in an ADR everyone can read.
  • Mistake: Assuming Kubernetes makes you portable. Why it is wrong: Ingress controllers, storage classes, load balancers and workload identity are still cloud-specific. Instead: Treat Kubernetes as one portability tool, alongside IaC modules per cloud and contract tests.
  • Mistake: Claiming portability without ever testing it. Why it is wrong: Untested exit plans fail when needed, and regulators expect evidence. Instead: Run a periodic portability drill on one service and record the measured effort.
  • Mistake: Two clouds, one team, no extra investment in security. Why it is wrong: Twice the IAM, network and logging configuration to get right, with the same people. Instead: Budget for the second platform's security baseline (Essential Eight controls on both) or don't add it.

πŸ› Senior insight: trade-offs

Multi-cloud is a business decision about risk and optionality, and a senior engineer's job is to price it. Most of the value people expect from it (resilience, negotiating leverage, the ability to leave) can be bought far more cheaply through multi-region on one cloud, containers, OpenTelemetry, standard data engines, Terraform and a tested exit plan. Use managed services where they save real effort, and be explicit about the lock-in you accept and what it would cost to undo.

Workload-per-cloud is the variant I'd accept most readily: after an acquisition, or when one cloud has a clearly better service for one system, each workload still uses its cloud fully and the cost is mainly a second platform baseline. Active-active across clouds is justified only for a small set of systems with extreme availability needs and the budget and team to match.

Option When it fits Cost When not to
Single cloud, multi-region Most systems, including regulated ones Moderate (second region, replication) Provider-level exit is a hard requirement with a short deadline
Single cloud with exit plan and drills Lock-in worries, procurement leverage Low (discipline, periodic drill) You never intend to act on it (then skip the ceremony)
Workload per cloud Acquisitions, best-of-breed, customer location Second platform baseline and skills One small team
Active-active multi-cloud Rare, extreme availability or regulatory mandate Very high (2x+ infra, people, data sync) Almost everyone else

Measure it with the exit cost in engineer-days from the last drill, the availability actually achieved against the SLO, egress spend, and incident counts per platform.

πŸ”— Follow-ups the interviewer may ask

  1. When: Candidate warns about building for hypothetical future needs Why: Checks how they spot over-engineering and push back without blocking real needs.
    How to answer

    At the architecture level, over-engineering means paying now, in hosting, cognitive load and delivery speed, for scale or flexibility nobody has evidence for. The warning signs are concrete signals to investigate: far more deployables than teams, Kubernetes and a service mesh for 50 requests a second when App Service or Container Apps would do, a message broker between modules in one process, a generic plug-in framework with a single plug-in. I judge them against the team's size, experience and on-call capacity, because the same design can suit eight platform teams and sink one team of five.

    I separate one-way doors (splitting data, event sourcing, choosing a region) from two-way doors (a library, a folder layout). One-way doors get analysis and an ADR; two-way doors get the simplest option. I keep options open with module boundaries rather than network boundaries.

    The trade-off: under-building something genuinely irreversible is costly too, so I write down the trigger that would justify the bigger design.

  2. When: Candidate says they would record the lock-in decision in an ADR Why: Checks how they document and communicate architecture decisions so they stay useful.
    How to answer

    I use three tools that reinforce each other. Architecture Decision Records capture each significant decision in one short page: context, decision, alternatives, consequences and status. They live in the repo and are reviewed by pull request; when a decision changes, a new ADR supersedes the old one.

    The C4 model gives diagrams at the right zoom level: System Context for stakeholders, Containers for engineers, Components where it helps. I keep them as code (Structurizr DSL or Mermaid) so they're versioned.

    Fitness functions stop the docs from lying: architecture tests (ArchUnitNET), load tests and dependency checks that fail the build when the code drifts from the decisions.

    The trade-off: documentation costs time, so I keep it small and automate the checks instead of writing long documents nobody reads.

  3. When: Candidate mentions mapping Azure services to AWS for portability Why: Checks that they know the concrete service equivalents and where they differ.
    How to answer

    Most Azure services have a close AWS match: App Service maps to Elastic Beanstalk or App Runner (though most .NET teams end up on ECS with Fargate), Functions to Lambda, Azure SQL to RDS for SQL Server, Blob Storage to S3, Key Vault to Secrets Manager plus KMS, Service Bus to SQS plus SNS, and Azure Monitor / Application Insights to CloudWatch plus X-Ray or OpenTelemetry.

    What catches Azure developers out is not the services but the plumbing:

    • IAM roles and policies do the job of managed identity plus RBAC, and policies are JSON documents you scope by resource ARN.
    • Accounts (grouped by AWS Organizations) are the isolation boundary, not resource groups.

    The trade-off: the names map one to one, but the operating model (identity, networking, accounts) does not.

πŸ›  Real-world problems: how you handle them

Board mandate to go multi-cloud after a regional outage
Situation
After [a multi-hour Azure regional incident] affected [a payments API] at [an APRA-regulated lender], the board asked for the .NET platform ([about 30 services] on Azure Container Apps and Azure SQL in Australia East) to run on both Azure and AWS within [12 months].
Signals
Board paper requesting 'multi-cloud resilience'; the incident review showed [3 hours] of downtime because the secondary region (Australia Southeast) had no warm standby and failover was manual and untested; CPS 230 business continuity obligations were being reviewed at the same time.
Investigation
Reviewed the incident timeline in Azure Service Health and Application Insights availability tests; mapped every service's dependencies on Azure-specific features (Service Bus sessions, managed identity, Key Vault references) with an architecture inventory; costed active-active on AWS (ECS, RDS for SQL Server, SQS FIFO, cross-cloud replication and egress) using both pricing calculators; ran a two-day spike deploying one service to AWS ECS with Terraform and LocalStack-tested adapters to measure exit effort.
Resolution
Presented three options with costs and residual risk. The board approved a warm standby in Australia Southeast with Azure SQL failover groups, automated failover through Front Door, and quarterly failover tests, plus a documented AWS exit plan backed by the measured spike and a yearly portability drill. Active-active multi-cloud was rejected in an ADR, with the conditions under which to revisit it.
Prevention
Quarterly regional failover game days with RTO and RPO measured; the AWS portability drill tracked in the risk register; ADRs for each Azure-specific dependency with exit cost; architecture tests that keep cloud SDKs out of domain and application projects.

How to tell it (STAR)

**S:** After a regional outage took our [payments API] down for [3 hours], the board asked us to run the platform on both Azure and AWS within a year. **T:** I was asked to [lead the technical response] and recommend how to meet the resilience goal. **A:** I went back to the incident and showed the real cause was an untested, manual regional failover, not Azure itself. I costed three options: active-active multi-cloud, warm standby in Australia Southeast, and single cloud with an exit plan. I also ran a two-day spike moving one service to AWS so the exit cost was measured, not guessed. I recommended the warm standby with automated failover and quarterly game days, plus a documented AWS exit plan, and wrote it up as an ADR for the risk committee. **R:** The board approved it at about [40%] of the multi-cloud estimate. Our first failover test came in at an RTO of [12 minutes], against [3 hours] during the incident.

More in AWS

Last updated 23 Nov 2026.

🌐 Sangam's Webring

βͺ Previous 🏠 Main Next ⏩
πŸ’¬ Chat with me