Amazon has announced it's come to an agreement to buy Whole Foods, the organic-food store chain for $42 a share. Amazon's offer represents a 27 percent premium to Whole Foods' closing price on Thursday, and values the deal at a whopping $13.7 billion, making this the biggest transaction ever for the e-commerce giant as it pushes deeper into the groceries business.

The comes deal as Whole Foods has been trying to fend off pressure from shareholders frustrated by a sluggish stock price. Back in April, activist investor Jana Partners took an 8% stake in the company and pushed the board to look into strategic options including a sale.

Amazon, on the other hand, has been expanding beyond online retail into physical stores. The company has opened about 10 brick-and-mortal bookstores and even more pop up stores at shopping malls throughout the country. It's also testing a variety of retail concepts, including convenience store that does not need cashiers, and a drive-in grocery service that delivers online-placed orders straight to your trunk.

This is by far Amazon's most ambitious move into physical retail. By acquiring the grocery chain, known for its health-first approach to food, the online retailer will get 460 stores in the US, Canada and the UK. Whole Foods Market will continue to operate stores under its own brand name.

"Millions of people love Whole Foods Market because they offer the best natural and organic foods, and they make it fun to eat healthy," Amazon CEO Jeff Bezos said in a press release. The companies expect the deal to close in the second half of the year.