Amazon (AMZN 2.50%) has come a long way since starting as an online book retailer in 1994. The company's stock has soared over 130,000% since it went public three years later, with its business expanding to now include countless other products, an extensive library of digital services, grocery, space satellites, and cloud computing. Amazon's growth has led it to achieve leading market shares in e-commerce and the cloud industry, suggesting the best time to buy the company's stock might have been a long time ago.

However, e-commerce sales only made up about 15% of all retail sales last year, which could mean the market is nowhere near hitting its ceiling. Meanwhile, a current boom in artificial intelligence (AI) is expected to bolster cloud revenue as businesses increasingly seek AI services. With solid positions in both markets, Amazon has a strong long-term outlook.

Here's why it's not too late to buy Amazon stock.

Amazon retains lead in cloud market and shows AI potential

The launch of OpenAI's ChatGPT last November stunned the tech world with its ability to produce human-like dialogue. The platform broadened what many experts thought was currently possible with AI, triggering countless companies to pivot their businesses to develop the industry.

One of the biggest markets to benefit from the AI boom is cloud computing, thanks to many businesses now rushing to use the technology to enhance their offerings. Amazon has seemingly fallen behind in this department, with its cloud competitor Microsoft procuring exclusive licenses to use several of OpenAI's AI models. However, Amazon is now making positive inroads into generative AI. 

The e-commerce giant has used AI for years in its retail business to track shopping trends, recommend products to consumers, and improve shipping logistics. Amazon's knowledge of the technology has led it to develop an AI model called Amazon Bedrock. The program is capable of top-of-the-line generative AI tasks, such as producing fully formed social media campaigns based on a company's product description. 

In April, the company announced it would make Amazon Bedrock available to Amazon Web Services (AWS) users, along with a service called Code Whisperer. This tool allows developers to input what they want and receive code to meet their needs.

Amazon may have started on the back foot in AI services, but its leading market share in the cloud market gives it an edge. If the company can wow AWS users with its current models, it will likely retain its position at the top and substantially profit from the quickly growing AI market.

The importance of a long-term perspective

Last year was particularly rough for Amazon, with macroeconomic headwinds leading to reduced consumer spending and a combined $10.6 billion in operating losses from its e-commerce segments in fiscal 2022. Inflation hikes have also caused businesses to slash cloud budgets, with AWS reporting slowing growth in recent quarters. As a result, it's essential to keep a long-term mindset with Amazon, as its dominating position in two crucial markets will likely pay off in the end.

The good news is that the first quarter of 2023 suggests the company's e-commerce business is in recovery mode. The quarter saw Amazon's North American segment return to profitability, reporting $898 million in operating income. Meanwhile, its international segment reported a marginal improvement. As inflation continues to ease and Amazon benefits from recent budget cuts, the company will likely continue to report improving e-commerce figures, with its dominant role in the market offering consistent long-term growth.

Unfortunately, AWS earnings growth continued to shrink in Q1 2023. However, the company is still in the early stages of its venture into AI cloud services. Amazon's vast retail knowledge could be a massive advantage in producing efficient AI models for AWS, with the company's leading market share in the sector attracting new users.

Amazon's stock has soared 54% year to date. Yet it remains 44% below the high of $186 it hit in July 2021, suggesting there's still room for a bull run. Alongside solid positions in two growing markets, it's not too late to profit from Amazon's long-term potential.