Not all companies are equally at risk from the (AMZN) - Get Report juggernaut.

CVS Health Corp. (CVS) - Get Report  may be better-equipped than Walgreens Boots Alliance Inc. (WBA) - Get Report to handle Inc.'s (AMZN) - Get Report move into the pharmacy business -- at least according to an RBC Capital Markets analyst.

Amazon on Thursday, June 28, said it was buying venture capital-backed online pharmacy PillPack, sending shares of drug store companies and drug distributors plunging. Terms of the deal were not disclosed, but the Wall Street Journal reported that the price tag was about $1 billion.

In a note on Friday, RBC analyst George Hill said the diversified assets of the pending CVS-Aetna Inc. (AET) combination "on a pro forma basis should enable CVS to better weather the risk that Amazon is able to grab pharmacy market share versus WBA." CVS in December agreed to acquire Aetna for $69 billion.

Hill lowered his price target on CVS to $84 from $91 on the heels of Amazon's PillPack deal, but said it will not be easy for Amazon to squeeze pharmacy margins in the near- to medium-term. He pointed to factors such as the  "the stickiness of payer/pharmacy relationships, decreasing share of mail order, and PillPack's tiny market share." On Friday, CVS shares were down 1% to $65.07 after having dropped 6% on Thursday after Amazon's deal was announced.

If Amazon does take market share and squeezes margins in the medium-term, Hill wrote that CVS is the better-equipped pharmacy to continue growing earnings before interest and taxes.

"Front-end revenue, where we view Amazon as posing a continual obstacle to growth, is just ~7.5% of our CVS/AET [estimated 2019 pro forma revenue], whereas it is ~19% of our WBA  [estimated 2019 pro forma revenue]," Hill wrote.

PillPack, founded in 2013, delivers medications in pre-sorted dose packaging and coordinates refills and renewals. It is available in 49 states.

Co-founder and CEO TJ Parker, a second-generation pharmacist, said in a Medium post in November that PillPack expected to generate more than $100 million in revenue in 2017.

Walgreens CEO Stefano Pessina said on an earnings call Thursday said his firm is "not particularly worried" about Amazon's PillPack acquisition, but added that Walgreens is "not complacent." He also reiterated that the role of physical pharmacies "will continue to be very, very important in future."

A CVS spokeswoman said in an email on Friday that CVS believes it is "well-positioned in the market and ahead in this area." She noted that CVS has multi-dose packaging capabilities and offers its ScriptPath Prescription Schedule, launched last fall, for patients managing multiple prescription medications.

Shares of Walgreens, which plummeted 9.9% on Thursday, were down another 0.5% to $59.42 on Friday. Amazon shares were flat on Friday afternoon after rising 2.5% on Thursday.

-- Katherine Ross contributed to this article

Amazon is a holding in Jim Cramer's Action Alerts PLUS member club. Want to be alerted before Jim Cramer buys or sells AMZN? Learn more now.