Scrivio Interview library
LeadershipAdvanced7 min read · updated 12 November 2026

Teams want to use Spring Cloud AWS integrations (SQS, SNS, S3, DynamoDB, Secrets Manager) widely. How do you balance convenience against cloud lock-in for a platform that may run on more than one cloud?

I would first make the portability requirement an explicit decision, because many companies rightly accept lock-in for managed services that bring real value. Then I would keep cloud-specific code at the edges behind small interfaces, in a ports and adapters style, so business logic never calls AWS APIs directly; use neutral abstractions only where they are mature, such as Spring Cloud Stream binders or OpenTelemetry, without designing for the lowest common denominator; keep an inventory of which services depend on which cloud services; and estimate exit costs periodically to inform contract negotiations.

Why this question is asked

Spring Cloud AWS makes AWS feel like part of Spring: a listener annotation for SQS, a template for S3, properties loaded from Secrets Manager. Teams love it because it removes boilerplate. A platform leader has to ask what that convenience costs if the company later needs to run on a second cloud, and whether that day will ever come. Interviewers ask this to see whether we can turn a vague fear of lock-in into concrete, proportionate decisions. In this answer, we will make the portability requirement explicit, see how ports and adapters contain cloud code, decide where neutral abstractions help, and set up the inventory and exit cost estimates that keep the decision honest.

1Make the Portability Requirement Explicit

Lock-in is not a yes or no property; it is a cost we may or may not need to pay later. So the first step is to ask the business a clear question: what is the realistic need to run outside AWS, and on what timeline? There are a few typical answers. Some companies have no plan to leave and value speed. Some must run in a second cloud because a large customer or a regulator requires it. Some want a credible exit option mainly to negotiate better prices.

Each answer leads to a different level of investment. If there is no real requirement, insisting on full portability makes every team slower and gives up the managed services that make the cloud worth paying for. Many successful companies accept deep lock-in deliberately, for example using DynamoDB or SQS because operating an equivalent themselves would cost far more. If a second cloud is a real requirement, we design for it from the start for the affected products. Writing the answer down as a platform principle, signed off by leadership, stops the debate from restarting in every design review.

Portability levels and what they cost
RequirementWhat we doCost to teams
No realistic need to leave AWSuse managed services freely; keep code tidylowest
Credible exit optionadapters at the edges, inventory, exit estimateslow to moderate
Must run on two cloudsneutral abstractions, tested on bothhigh
Most companies sit in the middle row.

2Keep Cloud Code at the Edges

Whatever level we choose, it is cheap to keep AWS-specific code out of business logic. The pattern is called ports and adapters, or hexagonal architecture. The business logic defines a small interface, a port, that describes what it needs in its own words, such as storing an invoice document. An adapter implements that interface with a specific technology, here S3 through Spring Cloud AWS.

Java
// Port: in the domain module, no AWS types
public interface InvoiceDocuments {
void store(InvoiceId id, byte[] pdf);
Optional<byte[]> load(InvoiceId id);
}
// Adapter: in an infrastructure module, the only place that knows about S3
@Component
class S3InvoiceDocuments implements InvoiceDocuments {
private final S3Template s3;
S3InvoiceDocuments(S3Template s3) { this.s3 = s3; }
public void store(InvoiceId id, byte[] pdf) {
s3.upload("invoices", id.value() + ".pdf", new ByteArrayInputStream(pdf));
}
public Optional<byte[]> load(InvoiceId id) { /* s3.download(...) */ return Optional.empty(); }
}
// Moving to another cloud = one new adapter; InvoiceService does not change

Notice that the interface is small and speaks the domain's language. It does not try to model every S3 feature, which is why it is cheap to write and cheap to reimplement. The same applies to listeners: an @SqsListener method should do little more than convert the message and call a domain service, so the domain service can be called from any other messaging technology later. A side benefit is testing: the domain can be tested with an in-memory implementation of the port, without any AWS emulator.

3Where Neutral Abstractions Help, and Where They Hurt

Some abstractions are mature and cost almost nothing. OpenTelemetry for traces and metrics works with every cloud's monitoring and with independent vendors. Spring Cloud Stream binders let the same message handler run on Kafka, RabbitMQ, or with community binders on cloud queues, which can be a good fit for event-driven services. Spring Boot's standard JDBC and JPA support makes a managed PostgreSQL on any cloud look the same to the code.

Other abstractions are a trap. Designing for the lowest common denominator means using only the features every cloud has in common. We would give up SQS's dead-letter redrive, DynamoDB's conditional writes or S3's lifecycle rules because another cloud's equivalent behaves differently. The result is slower to build, often less reliable, and still not truly portable, because the behaviour under failure differs anyway. So the rule is: use a neutral abstraction where it is mature and costs little; otherwise, use the cloud service fully, behind an adapter.

Step throughWhere cloud specifics are allowed
  1. Domain and business logicno cloud SDK or Spring Cloud AWS types
  2. Portssmall interfaces in domain language
  3. AdaptersSpring Cloud AWS: SQS, S3, DynamoDB, Secrets Manager
  4. Neutral platform piecesOpenTelemetry, JDBC, Stream binders where mature
  5. Cloud servicesAWS managed services used fully

5 layers, from the top down. Step through them one at a time.

4Track Dependencies in an Inventory

Leaders cannot reason about lock-in they cannot see. So we keep an inventory of which services use which cloud services, generated rather than maintained by hand where possible: from build files (which services depend on spring-cloud-aws-starter-sqs or the DynamoDB SDK), from infrastructure code (which queues, tables and buckets each service owns), and from IAM policies (which APIs each role may call).

The inventory answers practical questions quickly. How many services would be affected if we replaced SQS? Which services use DynamoDB in ways that have no direct equivalent elsewhere? Which teams still call AWS APIs from domain code? It also helps with everyday work, such as planning a Spring Cloud AWS upgrade, which is a nice reason for teams to keep it accurate.

5Estimate Exit Costs Periodically

Once a year, or before a major contract renewal, we use the inventory to estimate what leaving would cost: engineering effort per service to replace adapters and migrate data, the cost of running replacement services, data transfer charges for moving storage, and the risk during the migration. For example, if 120 services use SQS through thin adapters, replacing them might be a few days each; if 15 services depend on DynamoDB's specific consistency features, those need redesign and dominate the estimate.

This estimate is not a plan to leave. It is information. It tells procurement how credible our alternative is when negotiating a commitment, tells architects which dependencies are expensive, and tells leadership whether the portability level we chose still fits. If the exit cost grows much faster than expected, we can decide consciously whether to invest in containing it.

6Follow-up questions

Does Spring Cloud AWS itself increase lock-in?

A little, but not much more than the AWS SDK, because both are tied to AWS services. Its abstractions, such as the S3 resource and templates, can even make adapters smaller. The bigger factor is whether AWS types leak into domain code, which is a matter of discipline, not of library choice.

How do you enforce the boundaries?

With architecture tests, for example ArchUnit rules in the build that fail when a class in the domain package imports io.awspring or software.amazon.awssdk types, plus a review checklist for new services. Automated rules are much more reliable than guidelines.

What if a team wants to use a very AWS-specific service like Step Functions?

That is fine if it brings real value and the decision is recorded in the inventory with its exit cost. We just make sure the business rules that matter are not hidden only in the service's configuration, where they are hard to test and move.

7Conclusion

In this answer, we balanced convenience against lock-in by first making the portability requirement an explicit business decision, then keeping AWS-specific code in adapters behind small domain interfaces, using neutral abstractions such as OpenTelemetry and Stream binders only where mature, avoiding lowest-common-denominator designs, tracking cloud dependencies in a generated inventory, and estimating exit costs periodically to inform negotiations.

What to say in the interviewAbout 90 seconds aloud

Open with

I would start by making portability an explicit decision with the business, because lock-in is a cost we might pay later, not a sin. If there is no realistic need to leave AWS, forcing portability slows every team and wastes the managed services we pay for; many companies accept lock-in deliberately for things like SQS or DynamoDB.

Then, if they want more

If a second cloud is a real requirement, we design for it in the affected products. Most companies want a credible exit option, and for that I would use ports and adapters: the domain defines small interfaces in its own language, such as storing an invoice document, and adapters implement them with Spring Cloud AWS.

Listeners stay thin and call domain services. ArchUnit rules can fail the build if domain code imports AWS types. I would use neutral abstractions where they are mature and cheap, OpenTelemetry for observability, JDBC for databases, Spring Cloud Stream binders where they fit, but avoid lowest-common-denominator designs that give up useful features like SQS dead-letter queues or DynamoDB conditional writes.

Then I would keep an inventory of which services use which cloud services, generated from build files, infrastructure code and IAM policies. And once a year, or before contract renewal, I would estimate exit costs from that inventory. That is not a plan to leave; it informs negotiations and tells us if our chosen portability level still fits.

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 documentation below. 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 "Teams want to use Spring Cloud AWS integrations (SQS, SNS, S3, DynamoDB, Secrets...": https://scrivio-interview-library.netlify.app/spring-boot/spring-cloud/c6a205b6a0/