Quick revision
The short answer
I would push back on a company-wide abstraction. A common interface over AWS and GCP tends to support only the features both share, losing useful provider-specific ones, and it needs a dedicated team to keep up with both providers. Full cloud switches are rare, so the cost is paid every day while the benefit may never arrive. A better default is to isolate cloud calls in adapters inside each service and to use portable technologies, such as PostgreSQL, Kafka and S3-compatible APIs, where reasonable, keeping a shared abstraction only for capabilities where switching or multiple providers is a real plan.
What to remember
In this answer, we evaluated a company-wide abstract factory over AWS and GCP. A common interface supports only shared features, loses useful provider-specific ones, needs a dedicated team, and pays its cost every day for a switch that is rare and mostly about data and operations rather than client code. The better default is service-owned adapters plus portable technologies such as PostgreSQL, Kafka and S3-compatible APIs, with a shared abstraction reserved for capabilities where multiple providers or a switch are a real plan.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
I would push back on a company-wide abstraction. A common interface over AWS and GCP tends to support only the features both share, losing useful provider-specific ones, and it needs a dedicated team to keep up with both providers. Full cloud switches are rare, so the cost is paid every day while the benefit may never arrive. A better default is to isolate cloud calls in adapters inside each service and to use portable technologies, such as PostgreSQL, Kafka and S3-compatible APIs, where reasonable, keeping a shared abstraction only for capabilities where switching or multiple providers is a real plan.
Why this question is asked
Cloud portability sounds like prudent risk management: no vendor lock-in, a negotiating position, a way out if prices rise. Leadership proposals to achieve it through one internal library are common, and they deserve a careful technical answer rather than a reflexive yes or no. Interviewers ask this scenario to see whether we can evaluate an architecture decision by its daily costs and real probabilities, and offer a better alternative. In this answer, we will restate the proposal, examine the lowest-common-denominator problem, count the cost of maintaining the library, estimate the value of the option, propose adapters and portable technologies instead, and identify where a shared abstraction does make sense.
1What Is Being Proposed
The proposal is an abstract factory at company scale: an internal library with interfaces such as BlobStore, Queue and SecretStore, and two families of implementations, one for AWS and one for GCP. Every service would obtain its cloud clients only through this library, so that switching clouds later means switching the factory, not rewriting services.
The goal is legitimate. The question is whether this mechanism achieves it at an acceptable cost, compared with other ways of keeping our options open.
2The Lowest Common Denominator Problem
Two clouds offer similar services, but not identical ones. A queue interface that both SQS and Pub/Sub can implement must leave out what only one supports or what they do differently, such as FIFO queues with deduplication, visibility timeouts, ordering keys, dead-letter settings or exactly-once delivery options. Storage differs in conditional writes, storage classes and event notifications; secrets differ in rotation and versioning; and identity and permissions differ fundamentally.
So teams face a bad choice. Either they use only the common features, giving up capabilities they pay for and that would make their service simpler or cheaper, or the library grows provider-specific escape hatches, at which point services are no longer portable and the abstraction protects nothing. In practice, most such libraries drift into the second state within a couple of years.
| Capability | Shared core | Lost or awkward in the abstraction |
|---|---|---|
| Queues | send, receive, acknowledge | FIFO, ordering keys, visibility, DLQ settings |
| Object storage | put, get, delete, list | conditional writes, storage classes, events |
| Secrets | read a value | rotation, versions, fine-grained access |
| Identity | almost nothing | roles, workload identity, policies |
3The Cost Paid Every Day
A library that sits between every service and two clouds is a product, not a utility. It needs a team that tracks both providers' SDKs and new features, fixes bugs, handles security updates, writes documentation and supports dozens of teams. It also becomes a bottleneck: when a team needs a feature that the library does not expose, it waits for the library team or works around it.
Testing doubles too. A GCP implementation that no production service uses is never exercised by real traffic, so it decays quietly, and on the day of a switch we would discover that it does not behave like the AWS one under load. An abstraction that has not been run in production is a promise, not a capability.
4How Likely Is the Switch, and What Would It Really Take?
Full cloud migrations are rare, and when they happen they are driven by large business events, such as an acquisition, a major pricing change or a regulatory requirement, and take months or years whatever the code looks like. The data must move, the networking, identity, monitoring and deployment pipelines must be rebuilt, and the operations teams must learn a new platform. The client libraries inside services are a small part of that work.
A simple comparison helps leadership see the trade. If the library needs, say, four engineers permanently, plus slower feature work for every team, that cost is certain and recurring. The benefit is a reduction in one part of a migration that may never happen. Unless a switch is planned, or we already serve customers on both clouds, the expected value is usually negative.
5A Cheaper Alternative: Adapters and Portable Technologies
We can keep most of the option value at a fraction of the cost. Inside each service, cloud calls go through a small adapter that the service owns, expressed in the service's own terms, such as InvoiceArchive.store(invoice) rather than a generic BlobStore. The adapter can use every provider feature the service needs, and if a migration ever happens, the change is limited to that adapter.
- Business logicdepends on ports such as
InvoiceArchive - Service-owned adapterssmall, use full provider features
- Portable technologiesPostgreSQL, Kafka, Kubernetes, OpenTelemetry
- Cloud providerAWS today; the change surface is the adapters
4 layers, from the top down. Step through them one at a time.
Portability comes from the data and operations layers more than from client interfaces.
Alongside adapters, we choose portable technologies where the cost is reasonable: PostgreSQL rather than a proprietary database for most data, Kafka (managed or self-run) for event streaming, Kubernetes for deployment, OpenTelemetry for observability, and S3-compatible APIs where storage needs are simple, since several providers and products implement them. These choices keep the hardest parts of a migration, data and operations, portable, which matters far more than client code. Check the exact SDK method names for your SDK version; the point here is that the adapter is free to use them.
6Where a Shared Abstraction Is Worth It
There are cases where the proposal is right in a narrower form. If we already run on both clouds, for example because some customers require GCP, then a shared interface for the capabilities those customers use is a real need, tested by real traffic on both sides. If a switch is planned for a specific capability, such as moving object storage to a cheaper provider, a focused abstraction for that capability is justified for the migration period.
So my recommendation to leadership would be: no company-wide abstraction library by default; adapters inside services as a standard; portable technologies for data, messaging and operations; and a shared abstraction only for named capabilities with a real multi-provider plan, owned by a team and exercised in production on every provider it claims to support.
7Follow-up questions
Doesn't this leave us locked in to AWS?
Partly, but lock-in is a cost to manage, not something to eliminate at any price. With adapters and portable data and messaging, the expensive parts of a migration stay manageable, and we keep the provider features that make us faster today. We can also track our use of proprietary services and review it yearly.
How do you present this without seeming to dismiss leadership's concern?
By agreeing with the goal, keeping options open, and showing a cheaper way to reach most of it, with rough numbers for the library's cost and an honest estimate of the probability and size of a switch. Offering a concrete alternative standard turns a no into a better yes.
What would change your mind?
A concrete multi-cloud requirement, such as contracts that require a second provider, a regulator demanding an exit plan with tested failover, or a decision to migrate within a year. Then a focused abstraction, run in production on both clouds, becomes worth its cost.
8Conclusion
In this answer, we evaluated a company-wide abstract factory over AWS and GCP. A common interface supports only shared features, loses useful provider-specific ones, needs a dedicated team, and pays its cost every day for a switch that is rare and mostly about data and operations rather than client code. The better default is service-owned adapters plus portable technologies such as PostgreSQL, Kafka and S3-compatible APIs, with a shared abstraction reserved for capabilities where multiple providers or a switch are a real plan.
Open with
I agree with the goal of keeping our options open, but I would not do it with a company-wide abstraction library. First, a common interface over two clouds ends up supporting only what both share, so teams lose provider-specific features like FIFO queues, ordering keys, conditional writes or secret rotation, or the library grows escape hatches and stops being portable anyway.
Then, if they want more
Second, the library is a product: it needs a team to track both SDKs and support every service, and it becomes a bottleneck. And the GCP side, never used in production, would quietly decay. Third, full cloud switches are rare, and when they happen the hard parts are data, networking, identity and operations, not client calls.
So we would pay a certain daily cost for an uncertain, partial benefit. What I would propose instead is that each service isolates cloud calls behind small adapters in its own terms, like an InvoiceArchive, which can use every provider feature, and that we choose portable technologies where it is reasonable, such as PostgreSQL, Kafka, Kubernetes, OpenTelemetry and S3-compatible APIs.
Then I would reserve a shared abstraction for specific capabilities where we really run on both clouds or have a planned switch, with an owning team and production traffic on both sides.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Leadership wants every service to use an internal abstract factory that hides AWS and...": https://scrivio-interview-library.netlify.app/java/creational-patterns/b35ebc0b2e/