The strength of Amazon's high-margin cloud and advertising businesses can help the e-commerce giant sustain a valuation near $1 trillion, but there are threats to continued growth, RBC Capital's Mark Mahaney said.

"There are two major risks here with Amazon: One is regulation, and one is competition," Mahaney said on CNBC's "Power Lunch."

Amazon on Tuesday became the second publicly traded U.S. company, after Apple, to reach a $1 trillion market value. Its share price reached an all-time high of $2,050.50 before falling off to $2,039.51 and a market value of roughly $995 billion by market close. Amazon stock has gained more than 70 percent in 2018 and has more than doubled in the last 12 months.

"Because ... of the influence of these high-margin businesses and high-growth businesses, advertising and [Amazon Web Services], this is a different Amazon than we've seen in the past," said Mahaney, who is a managing director at RBC, covering the internet sector. "We think this type of valuation here is sustainable."

However, bullish as Mahaney is, he also sees a risk from "two massive competitors" in the cloud business: Microsoft and Google.

Michael Graham, Canaccord Genuity analyst, said Amazon is "doing a great job of developing new markets, like AWS." But he also agreed there were competitive risks for the AWS cloud computing business, which he said could dislocate the stock in the short term.

Three major players in cloud computing — Amazon, Microsoft and Google — "have been fairly comfortable with their market positions" until now, Graham said, but that could always change.

"If there were going to be a challenger that was price disruptive in the sector, it would be Google, because they are in third place and they have been talking about this as a place they'd like to invest going forward," he told "Power Lunch."

Avery Sheffield, partner at VantageWay Capital, said competition could hit Amazon, not only in the cloud sector, but also in its core retail business.

"What's interesting now is that Amazon's fast, two-day delivery and low prices are not a differentiating factor anymore," Sheffield said Tuesday on CNBC's "Closing Bell." "I receive everything now from Target and Walmart in two days — $35 or under for free shipping from Walmart, no Amazon Prime fee — these companies are dramatically outstripping Amazon's own core retail sales."

On the regulatory front, fears have been stoked, at least in part, by President Donald Trump tweeting that Amazon is a "no-tax monopoly" and declaring, as Bloomberg reported, that the influence of big technology companies, including Amazon, Facebook and Google, is a "very antitrust situation."

CFRA Research senior analyst Tuna Amobi said the existential regulatory threat was "somewhat overstated."

"People tend to throw Amazon in with the likes of Facebook, Google, etc., simply because they are in that FAANG universe. There is some validity to that, but I think the company itself ... is somewhat less exposed on that front," Amobi said.

Mahaney said Amazon could reasonably push back against regulation since its overall share of retail sales is still relatively small. But oversight might not be such a bad thing for Amazon, Mahaney said.

"These platforms are getting bigger. They are more powerful, they're more influential. They should be at least scrutinized for potential abuses of power — I haven't seen that in the case of Amazon — but the larger the company, the greater the potential," Mahaney said.

Despite their concerns, about 96 percent of analysts, including Amobi, Graham and Mahaney, are bullish on Amazon. Of the 47 analysts with ratings on Amazon, 45 say investors should keep accumulating shares, according to FactSet, which is the highest ratio of buy recommendations among the 10 most valuable U.S. tech companies.