Scrivio Interview library
DesignPrincipal8 min read · updated 12 November 2026

Your company stores several petabytes of user files uploaded over 12 years in one cloud provider's object storage, with application code calling the provider SDK directly. How would you assess and reduce the long-term vendor and cost risk?

We start by measuring: how much data there is by age, access pattern and owner, and what we pay for storage, requests and egress. The biggest savings usually come from lifecycle rules that move cold data to cheaper tiers and delete data nobody needs, backed by retention and ownership policies so nothing is kept forever by default. To reduce lock-in, we put storage access behind a small internal interface instead of SDK calls in every service, estimate the real exit cost including egress before assuming portability, and remember that S3-compatible APIs reduce lock-in but do not remove it.

Why this question is asked

After 12 years, a storage bill is rarely a single decision; it is the sum of thousands of small defaults. Every upload kept forever, every service that imported the provider SDK directly, every bucket nobody owns. At petabyte scale those defaults cost serious money and limit our options for years. Interviewers ask this question at a principal level to see whether we can reason about cost and lock-in with numbers rather than slogans. In this answer, we will build a picture of the current state, look at where the money goes, cut cost with lifecycle and retention, reduce coupling with an internal interface, estimate the real exit cost, and decide how far to go.

1A Quick Recap of How Object Storage Is Billed

Object storage charges in three main ways. Storage is charged per gigabyte per month, and the price depends on the storage class: a standard class for frequently read data, infrequent-access classes that are cheaper to store but charge per gigabyte read, and archive classes that are cheaper again but take minutes to hours to restore. Requests are charged per thousand operations, which matters for millions of small files. Egress, data leaving the provider's network to the internet or another cloud, is charged per gigabyte, and at petabyte scale it becomes the dominant cost of any move.

Lock-in is the cost of leaving or changing. It has a technical part (code written against one provider's API and features) and a data part (the time and money it takes to physically move the bytes). Both are real, and they need different answers.

2Assessing the Current State

We cannot reduce a risk we have not measured. The first step is an inventory, which the provider's own tools make possible: storage inventory reports and access logs per bucket. For each bucket and major prefix we want the size, the number of objects, the age distribution, how often objects are read, the storage class, and who owns it. In a 12-year-old system, a large share will have no clear owner.

We also look at the code side: how many services call the provider SDK directly, and which provider-specific features they use, such as event notifications, object lock, signed URLs or storage-class transitions. A search of the repositories for the SDK's package names gives a quick count. In a typical case we might find 40 services with direct calls, of which 30 only do put, get, delete and signed URLs, and 10 depend on events or special features.

3Where the Money Goes and Where It Can Be Saved

Let us put rough numbers on it, keeping in mind that prices vary by provider and region, so we check current pricing. Suppose we store 5 PB in the standard class at about $0.021 per GB-month. That is 5,000,000 GB times $0.021, about $105,000 per month, or $1.26 million a year, growing every month because nothing is deleted.

Now suppose the inventory shows that 70% of the data, 3.5 PB, is older than two years and is read almost never. Moving it to an archive class at around $0.004 per GB-month saves 3,500,000 GB times $0.017, about $59,500 per month, more than half the bill, with one lifecycle rule. And if the retention policy we agree with legal says files of closed accounts are deleted after 7 years, and that is 1 PB, deleting it saves the rest of that slice entirely. That is why lifecycle rules, tiering and deletion, are often the largest saving: they need no code change in any service.

But there is a catch. Archive tiers charge for retrieval and impose minimum storage durations, and restoring takes time. Before moving data, we check from access logs that it really is cold, and we keep anything users may open on demand in an infrequent-access class instead.

Cost levers for 5 PB (illustrative prices)
LeverEffortRough effect
Tier 3.5 PB of cold data to archivelifecycle ruleabout -$59,500 per month
Delete data past agreed retentionpolicy + ruleremoves that slice completely
Abort incomplete uploads, old versionslifecycle ruleoften a few percent
Fewer small objects (bundling)code changelower request costs
Move providerslarge projectegress first, savings later
Check current pricing; the order of magnitude matters, not the exact cents.

4Retention and Ownership So Data Is Not Kept Forever

Lifecycle rules only stay correct if someone decides what each dataset is for. So we set policy. Every bucket or prefix has an owning team and a retention class, recorded as tags, for example user-documents with 7 years after account closure, or upload-temp with 7 days. New buckets cannot be created without these tags, which the infrastructure code can enforce. Data whose owner cannot be found after a defined process is reviewed with legal and either assigned or scheduled for deletion.

The reason this matters for the long term is that storage cost is the only cost in the system that grows by itself. Without a default of deletion, every year adds to the bill even if traffic is flat.

5Reducing Coupling With a Small Internal Interface

Direct SDK calls spread the provider's types, error codes and retry behaviour through dozens of services. The fix is a small internal interface that covers what most services need, put, get, delete, list and creating signed URLs, with one implementation per provider. It is not an abstraction of everything the provider offers; it is the 90% that services actually use.

Java
public interface BlobStore {
void put(BlobKey key, InputStream data, long size, String contentType);
InputStream get(BlobKey key); // throws BlobNotFoundException
void delete(BlobKey key);
URI signedDownloadUrl(BlobKey key, Duration ttl); // provider-neutral signature
}
// S3BlobStore implements BlobStore -> today
// GcsBlobStore implements BlobStore -> only if we ever need it
Step throughStorage access after the change
  1. Product servicescall BlobStore, no provider SDK imports
  2. BlobStore libraryput, get, delete, signed URLs, metrics
  3. Provider adaptertoday one SDK; another only if needed
  4. Object storagebuckets with owner and retention tags

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

We migrate services to it gradually, starting with the 30 simple ones, as they change for other reasons. The remaining services that depend on events or object lock keep their direct usage, but now we know exactly which ones they are and what they depend on. Even if we never change provider, this interface pays off: we can add metrics, enforce key naming and change retry settings in one place.

6Estimating the Real Exit Cost

Portability is often assumed and rarely priced. Moving 5 PB out means paying egress, perhaps around $0.05 per GB at large volume, which is about $250,000, plus retrieval fees for anything in archive tiers, plus request costs for billions of objects. Some providers now offer egress waivers for customers leaving entirely; we check the current terms rather than assume. Then there is time: even at a sustained 10 Gbps, 5 PB takes about 46 days of continuous copying, so a real move is a months-long project with dual writes and verification.

S3-compatible APIs, offered by several other providers and by self-hosted systems, reduce the code part of that cost, because the same client code can talk to another endpoint. But they do not remove it: event notifications, IAM policies, lifecycle rules, object lock and storage classes differ between implementations, and those are often exactly the features our ten special services rely on.

So the honest conclusion is usually this: we do not plan a migration, but we keep the option affordable. Lifecycle and deletion cut the size, and therefore the exit cost, every month; the internal interface cuts the code cost; and we revisit the decision when a contract renewal gives us leverage.

7Follow-up questions

Should we go multi-cloud for storage to avoid lock-in?

Usually not for the bulk of the data. Storing petabytes twice doubles the largest cost to insure against an event that may never happen, and cross-cloud replication pays egress continuously. It makes sense for specific needs such as regulatory separation or a small critical dataset. For the rest, keeping the exit cheap through less data and a thin interface gives most of the benefit.

How do you get teams to agree to delete data?

Make it a policy decision, not a technical one. Legal and product agree on retention per data category, the platform turns that into lifecycle rules, and teams only confirm which category their data belongs to. Showing the monthly cost of each team's unowned or over-retained data in their own reports helps more than any mandate.

What about data the company must keep, such as audit records?

That data gets its retention class too, often with object lock or similar write-once settings so it cannot be deleted early, and it is usually the best candidate for archive tiers because it is rarely read. Keeping something for a reason is fine; keeping everything forever by default is the problem.

8Conclusion

In this answer, we assessed petabyte-scale storage by inventorying size, age, access and ownership, and by counting direct SDK usage. We saw that lifecycle rules, tiering cold data and deleting data past its retention, are usually the largest saving, and that retention and ownership tags keep the bill from growing by itself. To reduce lock-in, we placed storage behind a small internal interface, priced the real exit cost including egress and transfer time, and noted that S3-compatible APIs help with code but not with events, IAM and other features that differ.

What to say in the interviewAbout 100 seconds aloud

Open with

I would start with measurement, because 12 years of defaults hide most of the cost. I would pull storage inventory and access logs to see size, age, read frequency and owner per bucket, and search the code for direct SDK use.

Then, if they want more

Typically a large share of the data is old and almost never read, and some has no owner. That points to the biggest saving: lifecycle rules.

With 5 PB at roughly two cents per gigabyte-month, we pay about a hundred thousand dollars a month; moving 3.5 PB of cold data to an archive tier can save more than half of that without touching any service, and deleting data past an agreed retention saves the rest of it.

To keep it from growing again, every bucket gets an owner and a retention class, enforced when buckets are created. For lock-in, I would separate code coupling from data gravity.

For the code, I would introduce a small BlobStore interface covering put, get, delete and signed URLs, and migrate the simple services to it gradually, so provider-specific features are confined to a known list.

For the data, I would estimate the real exit cost: egress on 5 PB is hundreds of thousands of dollars and weeks of transfer time, so portability is not free. S3-compatible providers help with the API, but events, IAM and lifecycle features differ.

So I would not plan a move; I would keep the option cheap and use it at contract renewal.

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 "Your company stores several petabytes of user files uploaded over 12 years in one cloud...": https://scrivio-interview-library.netlify.app/spring-boot/web-other/4954c3ff90/