Amazon (AMZN -1.07%) released second-quarter earnings last week, and Wall Street partied like it was 2021. The stock surged by double digits, and some analysts rushed to increase price targets. Given the price action and glowing endorsements, would you believe me if I told you Amazon's quarterly operating income was cut in half year over year (YOY)? In fact, over the first six months of 2022, operating income has fallen from $16.6 billion last year to just $7 billion. 

So what gives?

Amazon is no longer just an online retail company

For several years, Amazon was known as a massive and growing online retail company with a cloud business attached. No more. Amazon should now be heralded as a cloud infrastructure and advertising company with an attached online retail component. Recent results demand it. Amazon Web Services (AWS) is far and away the market leader in cloud infrastructure services, and the growth continues.

The fantastic cloud results are why some of us called it a terrific time to buy Amazon stock when it dipped in May -- even headed into an economic slowdown.

AWS is on pace to triple its operating profit in just three years. Revenue has grown more than 33% so far this year, and operating income has risen 46%.

The cloud segment will produce nearly $83 billion in sales and $27 billion in operating income if this pace continues, as shown below.

AWS figures

Data source: Amazon. Chart and 2022 estimates by author.

No wonder investors clamor for a piece of this lucrative pie.

Don't sleep on advertising

Amazon is leveraging its tremendous reach with a burgeoning digital advertising revenue stream. Advertising services produced $12.6 billion in sales in 2019. In just six months of 2022, revenue reached $16.6 billion on 20% YOY growth. Sales will surpass $37 billion this year if this pace continues. The meteoric rise is pictured below.

Amazon advertising services revenue

Data source: Amazon. Chart and 2022 estimate by author.

Is that enough?

Overall profits have been battered this year despite the terrific results above. Amazon's North America and International segments have lost $5.2 billion from operations through Q2. Net income has plunged from $15.9 billion in profit to a $5.9 billion loss over this period. The causes are many, including rising costs for labor, raw materials, and logistics. Retail headwinds could persist as consumer sentiment is listless. But here's the key: The headwinds will dissipate. It's only a matter of time. Long-term investors find AWS and digital advertising too good to pass up in the meantime.