Amazon (AMZN 3.43%) and Microsoft (MSFT 1.82%) are the No. 1 and No. 2 companies, respectively, in the cloud infrastructure space. While Amazon pioneered the industry, Microsoft drove its recovery from the decline of the PC industry, primarily by pivoting to the cloud. Consequently, each stock has focused heavily on artificial intelligence (AI), a technology that relies heavily on the cloud for support.

Admittedly, both companies are among the largest companies in tech. Also, they both have large cash hoards and diverse income streams, so both AI stocks will likely outperform the S&P 500. Still, between the two, one probably holds the potential for higher returns.

Cloud Market Share, By Company, Q2 2023

Image source: Synergy Research Group.

The case for Amazon

Many investors consider Amazon an e-commerce company and may ignore Amazon Web Services (AWS), whose cloud platform drives most or all of its profits in most quarters. Nonetheless, Amazon pioneered the cloud industry and, as mentioned, has held on to its industry lead. It remains the leader, partially by excelling at AI. To that end, AWS leverages AI so its customers can create new AI-driven applications without worrying about infrastructure requirements.

Moreover, AWS's AI detects fraud, cybersecurity vulnerabilities, and issues with one's IT infrastructure. It can also analyze text and videos to extract key points.

Much of that functionality occurs through an AI application called machine learning (ML), which allows its AI to learn from mistakes and adapt systems without pre-programming. This can help resolve a business's problems, build and scale generative AI applications, and add AI to applications.

Although it generated only 16% of Amazon's revenue, AWS generated over $7 billion in operating income in the third quarter of 2023, well above the $4 billion combined for Amazon's two e-commerce segments. That resulted in a net income of almost $10 billion for the same timeframe, a considerable increase from the $3 billion earned in the same year-ago period.

Investors have caught on to Amazon's recovery and AI prowess in 2023, and the stock is up over 60% over the last year. And while some investors may wince at the 76 price-to-earnings (P/E) ratio, that earnings multiple is low by historical standards. With AI leading the way on the AWS side of the business, the company's fast-rising income could likely push the stock much higher.

Why investors might choose Microsoft

As mentioned, the cloud was Microsoft's saving grace. Once known for its PC operating systems and productivity software, its largest source of revenue now comes from its intelligent cloud segment, which supports Azure. Microsoft leverages Azure for applied AI services, cognitive functions, and ML. However, AI's reach affects virtually all parts of the company.

The company has integrated AI-related functionality into its productivity software. It accomplishes this through Microsoft Copilot, which helps users unlock productivity and skills through Word, Excel, and other applications. It also powers Business Chat, a large language model (LLM) that can produce output using one's data.

Furthermore, its LLM abilities were enhanced when it built an alliance with Open AI's Chat GPT. Thus, that technology supports Azure-related applications and the search functions in Bing Chat, which supports its chatbot.

Such functionality helped Microsoft generate more than $57 billion in revenue in the first quarter of fiscal 2024 (ended Sept. 30). And since it kept the cost of revenue growth to a minimal level, the $22 billion in net income in fiscal Q1 rose 27% from year-ago levels.

Like Amazon, Microsoft has benefited from the AI boom and the stock price increased more than 50% over the last 12 months. That resulted in a 36 P/E ratio, a historically high level over the last five years. Its AI prowess may have led to that multiple expansion, though the stock should keep rising despite that valuation.

Amazon or Microsoft?

Although both stocks should prosper, Amazon will likely drive higher shareholder returns. In Amazon's case, a comparatively small part of the company, AWS, drives most of its income increases, allowing it to maintain higher rates of earnings growth.

Admittedly, Amazon's higher P/E ratio may deter some investors. Still, its faster rate of profit growth will likely justify the higher earnings multiple as the reach of its AI tools grows.