A lifecycle rule moves objects to a colder tier on day 30 and deletes them on day 45 — what is billed?
answer
- the discount is rented in a block
- deleting early does not shorten it
- billed for time not stored
- compare remaining life against the minimum
- plus a fee charged per object moved
basics
~20 sBoth actions bill in full. A colder tier carries a minimum storage duration, so an object deleted after fifteen days there is still charged for the whole minimum, plus a per-object fee for the move — often more than the rent the rule saved.
solid answer
~40 sThe object is charged 30 days of warm rent, then the colder tier's **full minimum storage duration** even though it only lives there for fifteen days, plus a one-off **per-object transition fee** for the move itself. The minimum is the point: a colder tier is rented in a block, and deleting or moving early does not shorten the block. With a minimum longer than the object's remaining life, the transition is a guaranteed loss — you pay cold rent for time the object was not stored, on top of a fee, to save fifteen days of warm rent. The general condition is simple: a transition can only pay when the object's **remaining lifetime after the move exceeds the target tier's minimum storage duration**, and the rent saved over that lifetime exceeds the per-object fee.
code
yaml · 17 linesrules:
- name: archive-application-logs
appliesTo: logs/
transitions:
- afterDays: 30
toTier: cooler
expiration:
afterDays: 45
tierTerms:
warm:
minimumStorageDays: 0
retrievalCharge: none
cooler:
minimumStorageDays: 60 # invented for the example; each provider sets its own
retrievalCharge: perGiBRetrieved
transitionFee: perObjectMovedgo deeper
Recall that colder tiers bill a minimum number of days per object, so an object deleted soon after moving is still charged for the whole minimum.
Explain the arithmetic: the days saved are the gap between the transition age and the expiration age, and the minimum can make those days cost more cold than warm.
Diagnose it as a policy-consistency defect — a retention rule and a cost rule written separately — and state the one comparison that belongs in review whenever either age changes.
Set the standard: retention is the fixed input and the transition age is derived from it, with the tier's minimum and per-object fee part of the default that teams inherit rather than rediscover.
## The two rules and the two charges A **lifecycle rule** is a declarative policy on the store that acts on objects by age. It has two kinds of action: - a **transition rule** — at age N, move the object to a named storage tier; - an **expiration rule** — at age M, delete the object. They are independent, they are both written by whoever set the policy, and nothing in the store checks that they are consistent with each other. That is how the situation in the question is reached: someone set a transition at 30 days for cost and an expiration at 45 days for retention, on different days, for different reasons. The colder tier adds two charges the warm tier does not have: - a **minimum storage duration** — a floor number of days billed per object, regardless of how long the object actually stays; - a **per-object transition fee** — charged once, when the rule performs the move. ## Working the arithmetic Suppose the cooler tier has a minimum storage duration of 60 days — a made-up figure for the arithmetic; every provider sets its own, and they differ. Suppose too that the cooler tier rents at roughly a quarter of the warm rate. That ratio is an order of magnitude, not a price list. | Choice | What is billed | |---|---| | Leave the object warm for its whole life | 45 days of warm rent | | Transition at day 30, expire at day 45 | 30 days of warm rent + **60 days** of cooler rent + one transition fee per object | Days 30 to 45 are the only ones the rule can save on. Fifteen days of warm rent is what is at stake. In the cooler tier those fifteen days are billed as 60, and 60 days at a quarter of the warm rate is exactly fifteen days of warm rent. **The rule breaks even before the transition fee, and loses after it.** Add the fee, multiply by the object count, and the cost-saving policy is a line item on the bill. The forty-five phantom days are the mechanism worth naming out loud: you are billed for time the object was not stored. Providers describe it in different ways — some as continued storage charges to the end of the minimum, some as a separate early-deletion charge levied at the moment of deletion — but the amount is the same and it is not avoidable once the object has moved. ## The general condition Let `L` be the object's remaining lifetime after the transition, `min` the target tier's minimum storage duration, `warm` and `cold` the two rents, and `fee` the per-object transition fee. The saving is: `saving = L * warm - max(L, min) * cold - fee` Three readings follow directly: 1. If `L < min`, the `max` clamps to `min`, so you pay cold rent for time you did not use. This is the case in the question. 2. Even when `L > min`, the fee has to be earned back out of the rent difference; for a short `L` or a small object it may never be. 3. The nearer the transition age is to the expiration age, the smaller `L` is and the worse the trade — which is the opposite of the instinct that says "move it as soon as we are allowed to". ## Writing the rules so they agree - **Never set a transition age within one minimum storage duration of the expiration age.** If the data is deleted at 45 days and the tier's minimum is 60, no transition age is valid. Keep it warm and let it expire. - **Transition early, not late, when the object is long-lived.** With an object kept for years, moving at 30 days rather than 180 buys five extra months of cheap rent and the minimum is irrelevant. - **Treat retention as the input.** The retention window is usually fixed by policy or by law; the transition age is the free variable. Derive it from the window, not from a round number. - **Price the fee against the object count**, not against the data volume. The fee is per object, so the same terabyte costs far more to move as many small objects than as few large ones. ## What a good answer includes A candidate who only says "you get charged a minimum" has half of it. The other half is that this is a *policy consistency* failure: two rules, each individually sensible, that were never checked against one another or against the tier's terms. The check is one comparison — remaining lifetime against the minimum storage duration — and it belongs in review every time a transition age or a retention window changes.
- What is the general condition under which a transition can pay at all?The object's remaining lifetime after the move must exceed the target tier's minimum storage duration, and the rent saved over that lifetime must exceed the per-object transition fee. Written out: `L * warm - max(L, min) * cold - fee > 0`. If retention is shorter than the minimum, no transition age is valid.
- Does moving an object through two tiers in turn charge two minimums?Yes — each tier's minimum applies to the time in that tier, so a chain of transitions can clamp twice. A rule that moves an object cooler at 30 days and colder again at 45 will usually incur the intermediate tier's minimum in full, plus a second per-object fee.
- If the rule is a loss, does deleting the objects sooner recover anything?No. Once the object has moved, the minimum is committed; an earlier deletion changes nothing about the amount owed for that tier. Recovery comes from fixing the rule for future objects — raising the transition age or removing the transition — not from deleting faster.
A gym that sells a three-month minimum: cancelling in week two still bills the three months. Signing up two weeks before you move away is a pure loss, however cheap the monthly rate looked.
saying these in an interview costs you the question
- Assumes cold rent is prorated to the days actually used
- Thinks deleting early cancels the minimum storage charge
- Sets the transition age as close to the expiration age as possible
- Ignores the per-object fee because the rent difference looks large
- Believes a transition is free because no bytes leave the store