Some investors understandably worry about purchasing stocks when they are at all-time highs. While it seems like a stock would be vulnerable to a drop at those levels, it's best to look at the bigger picture. Over the long term if it's a quality business, the stock should continue to gain in value.

Amazon (AMZN 2.19%) recently hit a new all-time high in early May, but has pulled back a couple of percentage points since then. Still, I think Amazon's stock is a great buy right now. Here's why.

Its businesses are all enjoying incredible success

Amazon has been firing on all cylinders as a business. It divides its business into three divisions: North America, international, and Amazon Web Services (AWS). In previous quarters, at least one of its three major segments wasn't doing well, but that's not the case now.

The e-commerce side of Amazon, which is split up by geography, is much wider than its online store. It also includes rapidly growing segments like third-party seller services, advertising services, and subscription services. In fact, Amazon's online store segment only grew 7% year over year when all regions were combined. However, these other segments helped North American and international sales rise by 12% and 10%, respectively.

While that is respectable growth, the profits in these divisions were outliers. The North American segment delivered nearly $5 billion in operating income (up 455% year over year), and international delivered its first operating profit ($903 million) since the second quarter of 2021.

This is evidence that Amazon's efficiency focus continues to have a massive effect and will drive higher profits throughout 2024 if they stay on their current path. Should Amazon's trajectory continue, 2024 will be an exciting year on the commerce side of the business.

AWS is back in growth mode after a tough 2023

While the commerce side of the business delivers the bulk of revenue, the AWS cloud computing business delivers the profits. In 2023, AWS struggled because its customers were focused on optimizing their spending. According to management, that trend has largely wrapped up, and new workloads far outweigh the decreasing ones.

In Q1, AWS revenue rose 17% to $25 million, the highest total revenue in the cloud computing industry. This growth rate marks the fastest since Q4 of 2022. Higher revenue also drastically increased AWS's operating income, which rose 84% to $9.4 billion.

These figures clearly show why Amazon is hitting new all-time highs. Revenue is up double digits, and operating income is rising incredibly fast as well. This combines for a stock set to deliver more record highs should that success continue into Q2 and beyond.

Amazon shares trade at a premium

However, one drawback may be the stock valuation. Amazon trades at a high valuation if you utilize the forward price-to-earnings (P/E) ratio.

AMZN PE Ratio (Forward) Chart

AMZN PE Ratio (Forward) data by YCharts

Amazon's stock is hard to value because its earnings are rapidly increasing due to efficiency improvements combined with strong revenue growth. As a result, the forward P/E is a bit more of a shot in the dark than most investors would like.

Still, I think investors can confidently buy Amazon at this valuation because analysts only think Amazon will produce earnings per share of $4.53 over the next 12 months. In Q1 alone, Amazon produced $0.98 per share, and Q1 was historically one of Amazon's weakest quarters. As a result, I think the forward P/E of 40 is a conservative estimate, and the stock is far cheaper than that in reality.

Even though Amazon recently set a new record high, I'm confident it can continue to rise even more throughout 2024.