You cannot go wrong investing in either Palo Alto Networks (PANW 0.97%) or Amazon (NASDAQ: AMZN) since both of these tech giants are offering important services (cybersecurity and cloud computing, respectively) to businesses across the world. At the same time, both these stocks have also become more affordable for retail investors after their recent stock splits.

However, one of them is undoubtedly a better choice in the current inflationary environment. Let's analyze them in detail.

The case for Palo Alto Networks

While 2022 has been disastrous for many prominent software-as-a-service companies, Palo Alto Networks has proven to be an exception. So far this year shares of the leading cybersecurity player are currently down by 16%, far better than the NASDAQ Composite's decline of over 33% in the same time frame.

Since the COVID-19 pandemic, enterprises have been increasingly shifting their operations to a cloud environment. This coupled with the increasing prevalence of remote working has culminated in rising demand for cybersecurity services to protect ever-expanding "attack surfaces." Fortune Business Insights expects global cybersecurity to grow annually at a compounded average growth rate (CAGR) of 13.4% from $139.8 billion in 2021 to $376.3 billion in 2029.

Palo Alto is well poised to capture a significant share of this rapidly growing market opportunity. Widely known for its enterprise network security firewalls, the company is now also focusing on securing cloud-native applications. The company caters to over 85,000 customers across more than 150 countries in the world. The company has been increasingly focusing on large enterprises, a customer cohort that is relatively less susceptible to macroeconomic pressures. In fiscal 2022 (ending July 31, 2022), the number of active millionaire customers (customers spending over $1 million annually on the company's offerings) rose by nearly 31% year-over-year to 1,240.

Against the backdrop of rising security breaches, cybersecurity has become mission-critical for businesses. These trends have helped Palo Alto reduce topline volatility, despite macroeconomic pressures. With subscription and support making up over 80% of Palo Alto's total billings, the company also boasts significant revenue predictability.

Palo Alto reported impressive performance in the recent quarter, with both revenue and earnings surpassing consensus estimates. The company also reported generally accepted accounting principles (GAAP) profitability for the first time in the past four years. Additionally, management has also guided robust top- and bottom-line growth in fiscal 2023.

Palo Alto is currently trading at only 8.4 times its sales, which is much lower than early in 2022 when it was trading for more than 12 times sales. The company has authorized $915 million worth of share repurchases through December 31, 2023. Management expects to return significant value to shareholders in the coming quarters.

The case for Amazon

Amazon stock is currently down by over 32% so far this year. While the impact of inflationary pressures and supply chain constraints on its e-commerce business and a negative hit to its investment in electric vehicle player Rivian have dominated headlines, there still remains much to like in the company's growth story.

Amazon Web Services (AWS) accounted for a 34% share of the $200 billion global cloud infrastructure market in the second quarter (ending June 30, 2022), a one-percentage-point increase on a sequential basis. In comparison, AWS' key competitors, Microsoft Azure and Alphabet's Google Cloud, accounted for 21% and 10% of the global cloud market, respectively. Although AWS has clocked an annual run rate of $79 billion and profits of around $17 billion, the company believes that there is still a lot of runway left for this business segment.

While the ongoing consumer slowdown impacts Amazon's retail business, the company's Prime loyalty program, which has signed over 200 million members worldwide, continues to be a key competitive advantage. Prime members are incentivized to spend more money on Amazon services -- in March 2019, U.S. Prime members spent $1,400 on the site, compared to $600 spent by U.S. non-Prime members. Finally, Amazon is also poised to leverage its Prime member base to expand its presence in the digital advertising space. eMarketer expects the company to account for 14.6% of the U.S. digital ad revenue  spend in 2023.

Which stock should you buy now?

Although Amazon is currently a leader in e-commerce and cloud computing markets, it has been subject to intensifying competition worldwide. Additionally, increasing transportation and logistics costs due to rising inflation and over-investment in capacity expansion may harm the company's bottom line for the next few quarters.

Palo Alto's business model seems far more resilient since security threats are known to rise in difficult market times. So I think that Palo Alto might prove to be the better pick of the two in the current market.