Amazon (AMZN 0.15%) has rallied about 350% over the past five years thanks to the seemingly unstoppable growth of its e-commerce and cloud businesses. But with the bull market now in its eighth year, investors might be wondering how Amazon would fare during a bear market.

How hard will the bear bite?

Recessions are characterized by sharp declines in consumer and enterprise spending. That could be bad news for Amazon's marketplace business, which generates most of its revenue. However, Amazon's reputation as a low-cost leader could help it weather that downturn, just as low-end dollar stores flourished during previous recessions.

An Amazon fulfillment center.

An Amazon fulfillment center. Source: Amazon.

Lower enterprise spending could throttle the growth of AWS (Amazon Web Services), the cloud platform that generates most of Amazon's operating profits. If AWS' ongoing price war with Microsoft's (MSFT 1.40%) Azure and Alphabet's (GOOG 0.97%) (GOOGL 1.02%) Google Cloud continues as demand softens, its margins could be squeezed.

Declining AWS margins would hurt Amazon's marketplace business, since AWS' profits support its loss-leading ecosystem expansion strategies, which include cheap consumer electronics, streaming video, same-day deliveries, and new Prime perks.

However, demand for cloud infrastructure services should continue rising --even during recessions -- thanks to the growing use of streaming media, cloud-based apps, and other data-intensive tasks. As the biggest cloud platform in the world, AWS will likely remain the go-to solution for those service providers.

How Amazon fared during previous recessions

Since Amazon's public debut in 1997, the company withstood the dot-com crash, the September 11 attacks, and the financial crisis. The following chart illustrates Amazon's revenue and stock price growth during that period, which included two full-blown recessions.

AMZN Chart

Source: YCharts

Any investor who sold Amazon during those recessionary dips missed out on some spectacular gains. Moreover, Amazon wasn't even consistently profitable throughout most of that period:

AMZN Net Income (TTM) Chart

Source: YCharts

However, the bottom line boost from AWS since 2015 clearly indicates that Amazon's earnings growth should remain robust for the foreseeable future. Wall Street expects Amazon's earnings to grow 37% this year and 68% next year, which should offer better protection against recessionary shocks.

But what about Amazon's valuations?

The bears often point to Amazon's P/E of 196, noting that it's much higher than the industry average of 47 for specialty retailers and its earnings growth rate, and claim that the stock is overvalued. Its forward P/E of 137 doesn't look much safer.

However, high-growth companies like Amazon are usually more accurately valued by their free cash flow (FCF) growth. In the following chart, you'll notice that Amazon's EV (Enterprise Value)/FCF ratio has actually fallen over the past few years and stabilized, even as its stock price skyrocketed.

AMZN Chart

Source: YCharts

Granted, Amazon's EV/FCF ratio of 51 remains much higher than Alphabet's ratio of 24 and Microsoft's ratio of 17. However, it's hard to deny that Amazon stock actually got fundamentally cheaper as its price rose -- which means that it's better shielded from a market downturn than in previous years.

But that premium could be justified

Amazon has a high valuation, but investors have plenty of reasons to pay that premium. First, the company's growing Prime ecosystem is helping its marketplace crush both online and brick-and-mortar competitors.

Second, AWS remains well ahead of Microsoft's Azure and Google Cloud in the cloud infrastructure market, and its profitability supports the growth of Amazon's ecosystem into adjacent markets, like supermarkets, apparel, and even meal kits.

Any company caught in Amazon's blast zone is now considered "Amazoned". In addition to disrupting multiple industries, Amazon has plenty of growth opportunities in overseas markets like India and the Middle East.

The bottom line

I believe that Amazon could easily weather a market downturn. The stock might dip with the rest of the market, but investors should probably buy more shares during those pullbacks instead of selling.

Slowdowns in consumer and enterprise spending during recessions are inevitable, but I'm confident that Amazon can easily bounce back in both markets. It can also capitalize on market downturns by gobbling up smaller rivals at discount prices.