Amazon (AMZN -0.03%) continues to face one of its more challenging periods in years. Even after reporting a 9% net sales increase for 2022, the company failed to earn an overall profit.

Investors can find reasons to buy Amazon despite that sluggishness. The question is whether a critical challenge outweighs the reasons for owning the internet and direct-marketing retail stock.

Reason to buy: Amazon Web Services

Amazon Web Services, better known as AWS, is arguably the best reason to own the company. Amazon launched cloud services through AWS to support other online sellers, and its success ended up pioneering the cloud-computing business. Even though numerous tech companies have entered the cloud business in one form or another, Amazon remains the leader in this  space.

Cloud Infrastructure Market Share, Q3 2022

Image source: Synergy Research Group.

In 2022, AWS drove $80 billion in sales, rising 29% from 2021 levels. AWS also made up approximately 16% of Amazon's total.

Despite its relatively small portion of the overall revenue, AWS accounted for nearly $23 billion in operating income. An operating margin of almost 29% over the last 12 months made that income possible.

That compares well to the rest of the company, which reported close to $11 billion in operating losses and negative operating margins for 2022. Hence, AWS is the segment that currently carries the company.

Reason to buy: Advertising

Nonetheless, another part of the company that could help boost profitability over time is advertising. Google parent Alphabet and Meta Platforms have had success deriving revenue from ads, so Amazon has leveraged its extensive web presence to follow suit.

For years, it didn't share ad revenue with the public. But considering its success, one can see why Amazon began publishing figures on ad sales. In 2022, this part of the company brought in $38 billion in revenue, 21% more than in 2021.

Amazon didn't reveal the operating margin for that part of the business. Still, with Alphabet at a 26% margin and Meta reporting a 25% margin (which both companies derived primarily from advertising), it's likely a profitable part of the business for Amazon.

Reason to sell: E-commerce

However, Amazon no longer turns a profit in one surprising area: e-commerce. Many consumers, especially those who pay little attention to the stock market, may not know Amazon beyond e-commerce or the offerings on Amazon Prime. Additionally, with online selling driving over 84% of Amazon's revenue directly or indirectly, one cannot overstate its importance.

Nonetheless, many key metrics investors should see do not bode well for the company's retail operations. Amazon's retail-related revenue of $434 billion grew by only 6% in 2022. Also, with the growth of operating expenses exceeding its revenue increases, the non-AWS part of Amazon's business logged nearly $11 billion in operating losses in 2022.

Moreover, even when the e-commerce-related segments turned an operating profit, it was typically in the low-single digits, well under the 29% operating margin for AWS in 2022. Admittedly, retail is generally a low-margin business. Still, with more companies pivoting into e-commerce, Amazon's other segments will more than likely drive the company's profit growth.

Assessing Amazon stock

Despite Amazon's recent struggles with online selling, its stock probably remains a buy. Indeed, the company may have reached the point where e-commerce will no longer entice Amazon investors.

However, retailing keeps Amazon in the mind of the public, and the extensive web presence driven by e-commerce supports a fast-growing advertising business. Also, online selling inspired the creation of AWS, the segment that now accounts for all of the company's profits. Even if retailing continues to serve as a loss leader, investors have more reasons to buy Amazon than sell it.