The stock market may not look like a very optimistic place right now. Even some of the strongest stocks have struggled over the past year. In many cases, economic headwinds like rising inflation weighed on earnings -- and appetite for the companies' shares.

But here's the good news: A bull market is coming. History tells us these times of stock gains always follow bear markets. The one unknown is the exact timing.

So, what should we do while we wait? Invest in great companies with solid long-term prospects. And if they've dropped during these troubled times, we can pick them up for a bargain.

Amazon (AMZN -2.56%) is a perfect candidate. It's trading at its lowest in relation to sales since about 2015. Here are three more reasons to get in on the stock now.

1. The strength of AWS

When you think of Amazon, you probably think of e-commerce. But the company's cloud computing business -- Amazon Web Services (AWS) -- generally drives profit. Back in 2021, for instance, AWS' operating income made up more than 70% of Amazon's total operating income.

AWS has boasted double-digit growth in quarterly revenue and operating income over the years. The business has expanded its infrastructure throughout the world to manage data storage for major companies and organizations. For example, last year Delta Air Lines chose AWS to ramp up the transformation of its digital business. And AWS is the market leader worldwide.

It's true that AWS is facing somewhat of a slowdown right now as rising inflation hits the wallets of its clients. They're spending less than they usually would on storage solutions. Still, even as AWS' operating income slipped 2% in the most recent quarter, the business' revenue continued to climb in the double digits.

These economic headwinds are temporary. And as inflation eases and clients' budgets improve, AWS should become a big profit driver for Amazon again.

2. Growth of Prime

Amazon's also a market leader in e-commerce. Of course, inflation is currently weighing on e-commerce in two ways: It's increased Amazon's costs, and it's hurting shoppers' wallets.

As I mentioned concerning AWS, this situation is temporary. So once economic challenges ease, Amazon is set to rebound -- and this is thanks to its Prime membership program.

Prime offers members fast, free shipping, as well as other benefits like movies and books. Last year, Prime even launched a new feature: allowing members to Buy with Prime on various websites outside of Amazon. The advantage? The same checkout and shipping benefits members get on Amazon.

Amazon has been seeing results. Last year, Amazon said Prime members were relying more and more on the service for shopping and entertainment. And in the fall, the NFL Thursday Night Football premiere sparked the biggest three hours of U.S. Prime sign-ups ever. Over time, the company has increased members to more than 200 million worldwide.

All of this should lead to renewed revenue growth once consumer spending picks up -- and that's great news for earnings over the long term.

3. Amazon's efforts today

Meanwhile, amid today's difficult economic environment, Amazon isn't just waiting for better days. The company has taken action to better prepare itself for that time.

Amazon is working to improve its cost structure. This will help the company manage today's challenges -- but the impact won't stop there. A better cost structure will boost Amazon's growth in a strong economic environment, too.

Amazon decided to cut 18,000 jobs as part of this effort. The company has already seen some progress. For instance, in the fourth quarter, it said labor was better matched to demand compared with the year-earlier period.

Amazon also is seeing improvement in productivity across its fulfillment network. This is key -- because it quickly doubled this network right after the earliest stage of the pandemic and then faced excess capacity. This expanded network should serve Amazon well over time.

The company also has increased investments in AWS. And that's positive, considering the business' role in generating profit. Amazon increased its investment in technology infrastructure by $10 billion last year.

These investments today are costly in the near term -- even job cuts, as they result in expenses such as severance pay. But over time, they should pay off. And today's efforts could make Amazon a winner in the next bull market.