Amazon (AMZN 2.94%) released stellar earnings for the second quarter of 2023, stunning many on Wall Street and Main Street. The stock jumped 10% in after-hours trading and maintained the gains the next day. Total revenue grew 11% year over year (YOY) to $134 billion on the back of strong gains in third-party sales and advertising. Operating income ($7.7 billion) and operating cash flow ($16.5 billion) also improved significantly. Amazon proves yet again that the company is built to thrive even in a challenging economy, and we really shouldn't be surprised.

Why did Amazon stock go up?

It wasn't long ago that some claimed Amazon's best days were over. But, as I pointed out here, the company's transformation from an online retailer to a diversified services company meant that investors should look beyond short-term headwinds and use the downturn as an opportunity. The gains since have been spectacular, as shown below.

AMZN Chart

AMZN data by YCharts

The reason is simple. Amazon's vast ecosystem allows it to thrive in multiple high-powered sectors. Revenue diversity is an incredible strength.

When one is down, the others can pick up the slack. For instance, when logistical snarls and inflation derailed retail sales in 2021 and 2022, Amazon Web Services (AWS) experienced massive growth. Now, as AWS sees headwinds, advertising, Prime, and third-party seller services thrive.

How does Amazon make money?

We probably all know that Amazon is the largest ecommerce seller in the U.S. by a wide margin. Amazon holds 38% of the market, with Walmart a distant second at 6%. These sales are first-party (items sold directly by Amazon) and through its third-party platform where sellers list their products on Amazon.com for a fee. The third-party platform also yields revenue by charging fulfillment and shipping fees. This was particularly impressive in Q2 with $32.3 billion in revenue on 18% growth.

Prime subscriptions and digital advertising services work hand in hand with retail sales. Roughly 200 million people worldwide subscribe to Amazon Prime to take advantage of free shipping and digital services like Prime Video. Brands flock to use Amazon's advertising services as well. These include things like featured products or brands, and video ads on the site. Subscription services and advertising pulled in $10 billion and $11 billion, respectively, on 14% and 22% growth in Q2. 

AWS is the world's most prolific cloud services platform, outpacing Microsoft Azure. After growing at a more than 30% clip in 2021 and 2022, AWS sales growth has slowed this year as other companies look to save on data usage costs. Amazon is actively working with customers to lower their bills. This means sacrificing short-term sales but cementing long-term relationships. Even so, the segment produced $22.1 billion in revenue and 12% growth in Q2. AWS will also see demand from the artificial intelligence (AI) boom as data needs multiply.

Since a picture is worth a thousand words, Amazon's increasingly diversified revenue streams are depicted below.

Amazon revenue streams

Data source: Amazon. Chart by author.

No revenue stream makes up more than 45% of the total over the trailing 12 months. This makes Amazon an excellent company, and stock, to own for the long haul.

Is Amazon stock a buy?

Along with the strong footholds in the growth industries above, Amazon has serious tailwinds from the AI movement. Amazon Bedrock, for example, allows customers to customize existing AI applications (like chatbots) to suit their needs. And, of course, they run on AWS. The company is built for now and for the future.

Amazon stock has risen 63% in 2023 but is still 25% off its all-time highs. In Amazon's case, the price-to-earnings (P/E) ratio isn't a good measure currently because of the company's recent unprofitability. However, other metrics like the price-to-sales (P/S) and price-to-operating cash flow ratios indicate that the stock is still undervalued, as shown below.

AMZN PS Ratio Chart

AMZN PS Ratio data by YCharts

Growth investors would be remiss not to put Amazon stock on their shortlist. Few companies can match its vision, diversity, and performance. This makes the company an excellent stock to buy and hold for the long haul.