With a more optimistic tone taking over investors in 2023, Amazon (AMZN -0.66%) has rewarded its shareholders, rising 53% this year as of Oct. 9. This is on the back of a huge gain for the Nasdaq Composite Index, as well as other big tech stocks. 

Still, Amazon remains 31% below its all-time high price, and its current valuation looks attractive. But before investors rush to buy shares, it's worth taking the time to understand one green flag and one red flag for the business. 

Let's take a closer look at the e-commerce and cloud computing leader. 

1 green flag: Strength in retail 

According to Statista, Amazon accounts for nearly 40% of all e-commerce sales in the U.S., by far the largest share. This lead in online shopping was a boon during the pandemic, when consumers were flush with cash. But difficult comparisons, a normalization of shopping behavior, and general economic uncertainty led to much slower growth in 2022. 

Things look to be picking up in this segment, though. As it relates to Amazon's online and physical stores -- which when combined, account for 43% of companywide sales -- it's been a story of faster year-over-year revenue growth in the past couple of quarters. This is at a time when every other business line is posting slower gains. The company appears to be leaning on its bread-and-butter revenue generator.

What's encouraging is that this is all happening while inflation remains elevated. Clearly, consumers see the value that Amazon provides when it comes to low prices, a massive selection, and free delivery. Also, the recent gains could be a sign that better days are ahead.

Investors will also be happy to see that margins are trending in the right direction. The North America segment, which represented 61% of Amazon's total revenue last quarter, posted an operating margin of 3.9% in the second quarter after this metric came in at 1.2% in the first quarter. This is a huge improvement from a negative operating margin for all of 2022. 

CEO Andy Jassy hinted that margins could exceed pre-pandemic levels, meaning they could be well above 4%. Amazon is committed to running a more cost-efficient logistics network, something that will support margin expansion.

There's so much growth potential left when it comes to the e-commerce sector, not only in the U.S, but also on a global level as well. For Amazon, it's looking like 2023 might be when the gains start to pick up again.

1 red flag: Slowing cloud business 

Shareholders are undoubtedly familiar with Amazon Web Services (AWS), the company's cloud computing division. It commands about one-third of the worldwide market, and it has traditionally been the company's main source of operating profit. During the most recent quarter, AWS' $5.4 billion of operating income represented 70% of Amazon's total.

But investors aren't going to like that AWS increased revenue by only 12% in the second quarter. Since the start of 2022, growth has decelerated in every single quarter. What's troubling is that AWS is proving to be more cyclical than everyone had originally hoped. Indeed, companies are optimizing their spending on information technology, likely holding off on longer-term cloud investments until they see the economy is on better footing.

"AWS remains the clear cloud infrastructure leader with a significant leadership position with respect to number of customers, size of partner ecosystem, breadth of functionality, and the strongest operational performance," Jassy said on the second-quarter earnings call. 

That all sounds good, but Alphabet's Google Cloud division saw its revenue surge 28% in the three-month period that ended June 30. And competition from the likes of Microsoft's Azure isn't going to make things any easier. 

Nonetheless, investors might still view Amazon as a smart stock to buy, especially since shares are currently 11% below their 52-week high.