A small line item on Amazon.com's (AMZN -1.11%) balance sheet has been growing rapidly over the past couple years. Since the end of 2014, Amazon's unearned revenue liability increased from $1.8 billion to $4.8 billion. Some investors might see a growing liability and think that's bad news, but in fact this is very good news.

Unearned revenue is simply cash customers have paid to Amazon in advance for services it has yet to render. For example, Prime members typically pay $99 up front for a full year of the two-day shipping program. Amazon immediately takes the cash and puts it on its balance sheet, but it amortizes the $99 of revenue over the 12 months of the membership. So it accounts for only $8.25 per month in revenue per month for each Prime member. The rest of the cash received for Prime is held in the unearned-revenue balance.

Prime growth has been very good over the past few years. Amazon says it added "tens of millions" of new members last year. But Prime isn't the biggest driver of unearned revenue. More likely, Amazon Web Services (AWS) is the biggest factor pushing the balance higher.

A network of "cloud" computing servers.

Image source: Getty Images.

Maybe last quarter wasn't so disappointing

For the first time since Amazon started breaking out AWS revenue and income, the cloud-computing segment missed analysts' expectations. Sales totaled $3.5 billion in the fourth quarter, where analysts were expecting $3.6 billion on average.

But unearned revenue climbed $568 million from the previous quarter. That's unusual for Amazon's fourth quarter. Usually, unearned revenue spikes in the first quarter as cloud customers presumably re-up short-term contracts for the year.

Most of Amazon's AWS customers are small businesses using its pay-as-you-go pricing, which allows them to quickly scale their use. The solution works well for companies with small or unpredictable user bases.

But a lot of AWS's money comes from the big enterprises that spend hundreds of millions every year on cloud computing. For those companies, with more predictable usage needs, Amazon offers "reserved instances," which offers a discount if customers pay up front. Growth in reserved instances, or other long-term contracts, may have resulted in lower revenue in the short term, but it nearly guaranteed revenue in the future.

Locking in customers

As the competition for cloud-computing infrastructure continues to heat up, long-term contracts may prove invaluable. Locking in customers for a relatively long term means those enterprises will start optimizing their code so that it runs more efficiently on the specific hardware and platform they're using.

Such is the case with Snap (SNAP 4.71%), which uses Google's cloud. In its S-1 filing, Snap says it built its app to use "services provided by Google, some of which do not have an alternative in the market," as Re/Code's Peter Guagenti points out. Not only did Snap just agree to a $2 billion five-year contract with Google, but it's also going to be hard for it to leave Google even after the five years is up. That's excellent news for Alphabet (GOOG 0.56%) (GOOGL 0.69%) investors., and not as excellent for Snap investors.

Ultimately, signing long-term contracts provides a moat against the growing competition. Not only does it lock in customers for the length of the contract, but it could also lock them in longer if they become dependent on certain features of a cloud platform. In that light, Amazon's fourth-quarter AWS results look quite strong.