Macroeconomic headwinds in 2022 led to a sell-off that affected countless tech stocks, with Amazon (AMZN 1.08%) shares plunging nearly 50% throughout the year. The company suffered from significant declines in its e-commerce business and foreign currency fluctuations.

Despite the challenging year, Amazon remains a dominating force in the tech industry, with the world's fifth-largest market cap at $1.05 trillion. The company may not be entirely out of the woods in the e-commerce arena, but its strong positions in sectors like cloud computing will likely keep it growing for decades. 

However, before adding this tech giant to your portfolio, it's a good idea to understand its pros and cons. Here is one green flag and one red flag for Amazon stock in 2023. 

Green flag: Amazon stock is a bargain buy 

Amazon shares have begun recovering in 2023, rising 22% year to date. However, its stock remains down 37% year over year, suggesting it still has plenty of room for growth after the deep dive it took last year.

Moreover, Amazon's price-to-sales ratio (P/S) makes its stock a bargain compared to its peers. As seen in the chart below, Amazon has the best P/S among tech giants Microsoft, Apple, and Alphabet

MSFT PS Ratio (Forward) Chart.

Data by YCharts.

Amazon shares may have fallen out of favor over the last year, but its promising outlook over the long term makes its stock a compelling buy, and Wall Street agrees. The company's average 12-month price target of $137.82 is 35% higher than its current price.

Lastly, despite the sell-off, Amazon's stock has retained growth of 49% over the last five years and 674% over the last decade. The company has a history of offering consistent gains to patient investors, making its recent stock dip an attractive investment in 2023. 

Red flag: E-commerce headwinds 

Inflation peaked at 9.1% in June 2022, crippling certain markets where consumer spending decreased. That figure slowed to 6.4% in January and 6.1% in February but has continued to affect businesses in all industries.

The economically challenging environment hit Amazon's e-commerce business hardest, with its North American and international segments reporting combined operating losses of $10.6 billion in fiscal 2022. The headwinds also contributed to Amazon's free cash flow decline to negative $16.9 billion last year, a drop of 163% since 2020.

Amazon responded by trimming costs -- it laid off 27,000 workers over the last year, shutting down production or closing dozens of warehouses and sunsetting projects such as its telehealth service Amazon Care. And in January, the company secured a short-term loan of $8 billion to see it through any unforeseen hurdles over the next year. 

Despite recent challenges, Amazon had about $54 billion in cash and cash equivalents as of Dec. 31, suggesting it has the funds to overcome temporary headwinds and continue expanding over the long term. The company might experience further e-commerce losses in 2023. However, its dominating position in the market will likely pay off in the coming years as the economy recovers.

Is Amazon stock a buy?

The tech giant's e-commerce segments may have experienced substantial operating losses in 2022, but its cloud platform Amazon Web Services (AWS) more than pulled its weight. AWS' $22.8 billion in operating income made up 100% of the company's profits for the year. 

According to Grand View Research, the cloud market was valued at $484 billion in 2022 and is projected to expand at a compound annual growth rate (CAGR) of 14.1% through 2030. Meanwhile, Amazon's leading 34% market share will likely continue offering substantial gains for years.

Furthermore, the e-commerce industry is expected to hit $4.1 trillion in 2023 and reach $6.4 trillion by 2027, developing at a CAGR of 11.5% (per Statista). Despite recent headwinds, Amazon's 37.8% market share in the industry is immensely promising for its future.

With an excellent long-term outlook and a bargain stock price, Amazon is a must-buy right now.