Amazon.com (NASDAQ:AMZN) shareholders cheered the e-commerce giant's earnings release this week. The company posted a surprise profit again. That's twice in a row that Amazon has defied the Street's expectations by putting up some black ink. This time around, we're talking about a net profit of $79 million.

That may not sound like much, and in some ways it isn't -- it translates into a net margin of 0.3% -- but Amazon investors are already used to that. We already know that Amazon Web Services is skyrocketing in just about every way, crushing the competition in the process. AWS is the gift that keeps on giving, as it's becoming increasingly important for Amazon's overall profitability.

Sales are soaring while margins are expanding
Last quarter, AWS revenue jumped 78% to $2.1 billion. Revenue continues to march steadily higher in each sequential quarter with no signs of seasonality. Amazon also just hosted its fourth annual AWS re:Invent conference for customers and partners, where it laid out new offerings like QuickSight, a suite of business intelligence services.

Better yet, AWS is now beginning to scale meaningful in terms of operating leverage, even with all of its aggressive pricing moves. Amazon only recently began disclosing concrete around its AWS business, much to the gratitude of investors. There isn't data available quite yet on Q4 2014, but other than that quarter here's all of the profitability data that Amazon has shared to date.

Amzn Aws Profitability

Source: SEC filings.

The past few quarters have been particularly encouraging, with operating income and margins trending higher and higher. The dip in profitability makes sense considering Amazon's well-known habit of immediately reinvesting profits right back into the business. For instance, capital expenditures last year totaled $4.9 billion.

While much of this spending is for expanding warehouses and supporting fulfillment and $1.4 billion was for corporate office space and real estate, a lot of it is also dedicated toward technology infrastructure and AWS. About $537 million was allocated toward internal-use software and website development.

To be clear, Amazon is still investing heavily, having spent $3.3 billion on capital expenditures through the first three quarters of this year, but that's a modest decline from the comparable period a year ago, and this is also where the aforementioned operating leverage comes into play.

The gift that keeps on giving
Going forward, AWS will continue to be one of the most important contributors to Amazon's operating income. The e-commerce side has always had notoriously thin margins (operating margin of 3.5% in North America while international operations are operating at a loss), but AWS is able to easily pull its weight off a smaller revenue base.

Compared with rivals such as Microsoft (NASDAQ:MSFT) Azure, AWS is relatively more important to Amazon's bottom line. The software giant also just reported earnings, and while Azure revenue more than doubled, Microsoft's cloud computing business still pales in comparison to its other cash cows. Microsoft doesn't even break out Azure results separately.

AWS generated just about as much in operating income as the core North America segment did, but off a seventh of the sales. That means AWS is responsible for wholly half of Amazon's consolidated operating income. This trend isn't going away anytime soon, either.

Evan Niu, CFA has no position in any stocks mentioned. The Motley Fool owns shares of and recommends Amazon.com. The Motley Fool owns shares of Microsoft. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.