Whether you're a casual investor or trade professionally, you're likely aware of the boom in the artificial intelligence (AI) market that has captivated Wall Street over the last year. The launch of OpenAI's ChatGPT toward the end of 2022 reinvigorated the industry and led countless companies to pivot their businesses toward AI.

Excitement over the generative technology has led to companies across tech enjoying significant stock growth. Notable are Nvidia (NVDA 0.25%) and Amazon (AMZN 3.90%), which have seen their share prices soar 222% and 45%, respectively, since last June. These companies have achieved powerful positions in AI, with one leading the chip market and the other excelling in software.

Despite recent growth, these companies likely still have much more to offer new investors, with the AI market projected to expand at a compound annual growth rate of 37% until at least 2030.

So, let's take a closer look at these tech giants and determine whether Nvidia or Amazon is the better stock to invest in AI this June.

Nvidia

After soaring growth over the last year, Nvidia introduced a 10-for-1 stock split on June 10. The split has lowered its price per share, making now an attractive time to buy -- and multiple analysts seem to agree.

Argus Research and Oppenheimer recently increased their price targets from $110 per share to $150, maintaining a buy rating. Meanwhile, Evercore ISI raised its target to $145 from $131, expressing a similar sentiment.

Despite delivering record gains, Nvidia's powerful position in AI and tech in general indicates it's still nowhere near hitting its ceiling. The company maintains an estimated 90% market share in AI graphics processing units (GPUs) -- the chips necessary to train AI models. Meanwhile, chip demand is expected to rise for the foreseeable future as the AI market develops.

Moreover, Nvidia is keeping up with the demand for powerful hardware and retaining its lead among competitors by making a change to its product release schedule. The company will now design new chips yearly rather than every two years, like was once customary.

The move has forced rivals like AMD to do the same. However, with $39 billion in free cash flow compared to AMD's just over $1 billion, Nvidia is better equipped to retain its lead in AI and keep investing in its business.

Amazon

Like Nvidia, Amazon is leading its respective area of AI. The company is home to the world's largest cloud platform, Amazon Web Services, which outperforms competitors Microsoft's Azure and Alphabet's Google Cloud in market share.

As a result, Amazon has been able to leverage its extensive list of clientele to tout its AI products and get ahead in the industry. The company's success was evident in recent quarterly earnings. In the first quarter of 2024, AWS posted revenue growth of 17% year over year, with operating income soaring 84%. The segment has quickly become the most lucrative part of Amazon's business, responsible for 60% of its operating income.

Consequently, Amazon is investing billions into expanding AWS' reach and building data centers in multiple countries, including Taiwan and India. Meanwhile, AWS has ventured into chip design, announcing its Trainium2 chips last year, built specifically for training AI models.

Amazon's free cash flow has soared more than 1,000% since last June, while its operating income has increased by 99%. The figures highlight the reliability of Amazon's business and prove it has the financial resources to go far in AI.

Is Nvidia or Amazon the better AI stock this June?

Nvidia and Amazon have delivered stellar gains thanks to AI, but they are likely not done yet. These companies continue to have massive growth potential in the industry and would likely prove to be assets to any portfolio over the long term. As a result, it could be a good idea to consider their valuations when determining which is the better buy.

NVDA PS Ratio Chart

Data by YCharts

This chart shows Amazon's stock is trading at a bargain compared to Nvidia's, with a lower price-to-sales and forward price-to-earnings ratio. In addition to a promising position in AI, Amazon is a no-brainer over Nvidia right now. However, it's still worth keeping an eye on Nvidia and investing when the time is right.