For some, Amazon (AMZN -1.64%) and DigitalOcean (DOCN 0.95%) might be considered as the Goliath and David, respectively, of the cloud infrastructure services market. Amazon Web Services (AWS) controlled 32% of the global cloud infrastructure market at the end of 2022, according to Canalys, making it the clear market leader. DigitalOcean, which focuses on services to much smaller businesses, generated the equivalent of less than 1% of AWS' revenue last year.

The larger players generally fare better in this market than the smaller newcomers, since maintaining a cloud infrastructure platform requires massive investments in servers, networking equipment, and software. It can also be tough to maintain pricing power and generate consistent profits in that highly competitive space.

A digital illustration of a cloud.

Image source: Getty Images.

Therefore, Amazon might initially seem like a better cloud play than DigitalOcean, which only went public two years ago and now trades nearly 20% below its initial public offering price.

But since the beginning of this year, DigitalOcean's stock price has rallied more than 50% while Amazon's stock has advanced by less than 25%. Let's see why DigitalOcean outperformed its much larger industry peer -- and if that trend will persist throughout the rest of 2023.

Why did Amazon disappoint its investors?

Amazon only generated 16% of its revenue from AWS in 2022, while the rest mainly came from its retail-oriented businesses. However, AWS also brought in all of Amazon's operating profits because it operates at much higher margins than Amazon's other businesses. Amazon usually subsidizes the growth of its lower-margin e-commerce business with AWS' higher-margin revenue, but that long-term plan hit three speed bumps last year.

First, the growth of AWS cooled off as the macro headwinds forced companies to rein in their spending on big software upgrades. That's why AWS' revenue only rose 29% in 2022, compared to its 37% growth in 2021. Second, AWS' slowdown coincided with the post-pandemic slowdown of Amazon's e-commerce business, and that deceleration was exacerbated by the inflationary headwinds over the past year. Lastly, Amazon's big investment in the electric vehicle maker Rivian Automotive backfired, and the unrealized loss on that stake became dead weight on the company's bottom line.

The simultaneous slowdown of Amazon's two core growth engines caused its total revenue to only rise 9% to $514 billion in 2022. Meanwhile, Amazon's shrinking operating margin and its underwater investment in Rivian caused it to post a net loss of $2.7 billion -- which was a stunning drop from its net profit of $33.4 billion in 2021.

For 2023, analysts expect Amazon's revenue to rise another 9% to $558 billion as it returns to the black with a net profit of $14 billion. The outlook, which assumes the macro environment will improve and that Rivian will recover, is encouraging. Its stock also doesn't look too expensive relative to those expectations at less than 2 times this year's sales.

Why did DigitalOcean impress the bulls again?

DigitalOcean offers much smaller slices of physical servers (called "droplets") to small and medium-sized businesses at lower prices than larger cloud platforms. Focusing on that narrow niche seemed like a questionable choice in a market that favors economies of scale, yet DigitalOcean continued to grow even as it faced tougher macro headwinds, a loss of revenue from blockchain-oriented customers during the crypto crash, and the impact of Russia's invasion of Ukraine.

DigitalOcean's revenue rose 34% in 2022, compared to its 35% growth in 2021, while its net dollar retention rate -- which gauges its year-over-year revenue growth per existing customer -- improved by 2 percentage points to 115%. Its average revenue per user grew 25% in both years. It expects its revenue to rise another 21% to 25% in 2023, and for its top line to continue growing at a compound annual growth rate of at least 20% from 2022 to 2025.

DigitalOcean isn't profitable on a generally accepted accounting principles (GAAP) basis yet. But its adjusted gross margin; operating margin; adjusted earnings before interest, taxes, depreciation, and amortization (EBITDA) margin; and free-cash-flow (FCF) margin have all improved over the past three years. It expects its adjusted EBITDA margin to expand from 34% in 2022 to 38% to 39% in 2023 as it cuts costs and recognizes some cost-cutting synergies from its recent acquisition of Cloudways.

Analysts expect DigitalOcean's revenue to rise 22% to $705 million as its adjusted EBITDA climbs 36% to $269 million. The stock also looks reasonably valued at about 6 times this year's sales. Unlike Amazon, DigitalOcean is a pure cloud play that isn't burdened by lower-margin retail segments that are heavily exposed to inflationary headwinds.

The better buy: DigitalOcean

Amazon is still a reliable long-term investment, but its stock could stagnate this year until its e-commerce and cloud businesses start generating stable growth again. Meanwhile, DigitalOcean still looks underappreciated -- and its stock could still have a lot more upside potential than Amazon's if a new bull market kicks off this year.