With COVID cases surging again because of the more contagious delta variant, July saw some higher market volatility, with worries over the sustainability of the strong recovery thus far.

And make no mistake: The recovery has been strong to date, with earnings reports of large financial and big tech companies showing an otherwise strong economy.

However, the market never goes up in a straight line, and pullbacks of 10% or even 20% are regular market occurrences. Should variants force us back into lockdowns, it's quite possible the market could have another big pullback.

So how do investors prepare for the worst, while still positioning for further upside, should the recovery continue? The following stocks are not only lockdown and recession-resistant, but are reasonably valued with material upside in a recovery scenario as well.

A man with briefcase walks down an empty street with a cloud over him and electric lights raining down.

Cloud infrastructure giants would do well relative to other stocks in another lockdown. Image source: Getty Images.

Cloud infrastructure giants

First up on the list are today's largest tech companies: Alphabet (GOOG -1.96%) (GOOGL -1.97%), Amazon (AMZN -1.65%), and Microsoft (MSFT -2.45%). Not only do all of these three companies have cash-rich balance sheets, but these "big three" are really the only ones large enough to participate in the all-important cloud infrastructure industry. Cloud computing flexibility proved a key capability during lockdowns last year, accelerating this transition as the benefits of cloud became even more obvious.

Tech research firm Gartner (IT -1.05%) expects the cloud infrastructure market to grow 38.5% this year and 30.2% next year, as the pandemic has accelerated cloud migration in enterprises large and small. Gartner VP Sid Nag said in the April report:

The events of last year allowed CIOs to overcome any reluctance of moving mission critical workloads from on-premises to the cloud... Emerging technologies such as containerization, virtualization and edge computing are becoming more mainstream and driving additional cloud spending. Simply put, the pandemic served as a multiplier for CIOs' interest in the cloud.

Those lofty projections were met, and even exceeded, by strong cloud performance from each company this earnings season. Microsoft's Azure unit grew revenue 51%, while Alphabet's growth came in at an even higher 54%, albeit off a smaller base. Though market leader Amazon sold off after earnings due to decelerating e-commerce sales, its AWS cloud unit accelerated its growth 37%, up five percentage points over its Q1 growth figure.

Despite these big numbers to date, many think we are still in the relatively early innings of cloud transformation. With all three companies posting tremendous growth and increasing profitability, the cloud infrastructure market should be a "dreamy" combination of high-growth and high profitability for all three companies over the next decade.

And of course, all three companies also have very nice core businesses as well. Amazon and Microsoft would especially benefit from a COVID resurgence, as people would again be flocking to Amazon's leading e-commerce site and/or buying Windows-based laptops and Xbox consoles. Alphabet's core business may suffer somewhat in a COVID slowdown, although the company's 2020 slowdown proved to be short-lived. Even before vaccines rolled out in earnest, Alphabet's ad-based revenue came roaring back later in the year as advertisers flocked to Google search and YouTube by the second half.

Not only do these top companies have cloud tailwinds and defensive business models, but their stocks are actually quite reasonably priced, so don't be afraid to buy more of these stocks today and hold for the long-term, regardless of what the future holds for COVID variants.

A nurse administers a COVID vaccine.

Image source: Getty Images.

mRNA all-stars

It may seem obvious to have some exposure to the two main mRNA-based therapy innovators, but investors could also benefit long-term from exposure to both Moderna (MRNA -2.45%) and Germany-based BioNtech (BNTX -1.57%). Not only do these two biotechs benefit from continued vaccine and booster development, but each company also has a growing pipeline of mRNA-based treatments for other indications as well. So the companies offer a hedge against variants as well as potential upside in mRNA-based treatments.

In fact, on Pfizer's (PFE -3.85%) recent conference call (Pfizer has partnered with BioNtech on its COVID vaccine), Chief Scientific Officer Mikael Dolsten said a booster shot may be necessary against the delta variant, especially for those 50 and up. A third shot of the vaccine would certainly add to both companies' revenue and earnings, even though COVID shots have already brought in more revenue in a single year than any other drug in history. And if more variants or other coronaviruses emerge in years to come, Moderna and BioNtech would be the leading candidates to combat those as well.

Analysts expect COVID-related earnings to peak this year but remain elevated in 2022. BioNtech trades at around 9 times this year's earnings and 11 times 2022 estimates, while Moderna trades at 14 times 2021 estimates and 19 times 2022 estimates. But each company has a robust pipeline of mRNA candidates, with Moderna looking toward vaccines for the flu, Zika, HIV, cancer, and other cardiovascular and auto-immune indications. BioNtech also has over 20 pipeline candidates, across similar oncology and other infectious disease indications.

mRNA vaccines have proved to be the best technology at protecting against all COVID variants, and while other diseases like cancer and malaria may be difficult to treat, it's not crazy to think mRNA's success with COVID could be a harbinger of future success in other diseases. That's why investors shouldn't hesitate to get some exposure to these companies, even after their massive runs to date.