Amazon has held preliminary talks with makers of generic drugs about its potential entry into the pharmacy space, according to people familiar with the discussions.

The conversations, including with generics giants Mylan and Sandoz, a unit of Novartis, have been high-level, and the nature of Amazon's plans isn't yet clear, said the people, who asked not to be named because the discussions aren't public.

Shares of Mylan were up nearly 2.5 percent in after-hours trading.

Health care investment bank Leerink confirmed in a note to investors on Thursday that Sandoz' Peter Goldschmidt at a recent biopharma event "met and discussed with Amazon its plans for getting into the U.S. healthcare market." But it was not made clear whether Amazon will enter as a drug wholesaler, meaning business-to-business, or sell generic medications as a retailer.

Sandoz also said it does not expect Amazon to have a "major impact" on its business.