It isn't a stretch to say that artificial intelligence (AI) helped to propel the market to terrific gains in 2023. Before the release of ChatGPT and the rush to invest in generative AI, Wall Street was buzzing with worry over inflation, interest rates, and a recession that hasn't materialized. The tone changed quickly, and markets are near record highs.

How much will companies invest in AI in 2024? Nvidia (NVDA -1.02%) and Amazon (AMZN -0.73%) will be excellent barometers. Here's why.

Watch Nvidia's sales growth

At the heart of Nvidia's recent success is its high-performance graphic processing units (GPUs) and data-accelerating software. These products are crucial for generative AI and other machine learning (ML) applications that require tons of data to be processed in the blink of an eye. This is why Nvidia's quarterly data-center sales have risen 450% since the fourth quarter of fiscal 2022 to $14.5 billion in fiscal Q3 2024, ended Oct. 29, 2023.

The infographic below helps illustrate the story.

Nvidia infographic

The two areas that illustrate the most about AI demand are data-center revenue and operating income.

Data centers provide the infrastructure needed for AI software to function. When Nvidia's data-center revenue is skyrocketing, investors know that companies are investing heavily. The $14.5 billion produced in fiscal Q3 2024 is nearly as much as the $15 billion produced in the entire fiscal 2023 year.

Nvidia generated $10.4 billion in operating income last quarter, a 57% operating margin. This is an astronomical increase over its 16% operating margin in fiscal 2023 and 37% in fiscal 2022. This means that the demand for Nvidia's products is so strong that Nvidia can set the price in the market.

If these metrics persist, you will know that companies are opening their checkbooks to invest in AI.

Nvidia stock rose nearly 240% in 2023 on the back of these results. The stock trades near its all-time high and with a forward price-to-earnings (P/E) ratio of 40 (compared to Microsoft's forward P/E of 34, for instance). The valuation is steep; however, it can come down quickly if the company continues on its current trajectory.

Watch AWS for increased data usage

Amazon stock also had a terrific 2023, posting gains of about 80%. However, one concern investors voiced was the significant slowdown in growth for Amazon Web Services (AWS).

As depicted below, AWS revenue growth peaked in 2021 at 37% and fell to just 10% over the trailing 12 months as of Q3.

AWS sales by year

Data source: Amazon. Chart by the author.

AWS makes money like a power or gas company -- customers pay for what they use. Many companies cut their data usage budgets for 2023 in preparation for a recession. Because of this, Amazon needed to work with customers to lower their costs. Amazon did this, sacrificing sales in 2023 but developing customer loyalty for the long haul.

Companies may begin to spend more on data as they develop AI and ML software. AWS growth may increase, which will be a boon for Amazon's shareholders.

As shown below, Amazon's stock remains historically undervalued on a price-to-sales (P/S) and price-to-operating-cash-flow basis despite its tremendous run in 2023.

AMZN PS Ratio Chart

AMZN PS Ratio data by YCharts

The valuation and strong chance that AWS growth will accelerate make Amazon a compelling stock for long-term investors.

AI exploded onto the scene in the past year, and there are many things investors need to consider. For a start, tech investors should closely monitor the results of these two tech titans.