That's exactly what Amazon demands for one of its ebook programs, KDP Select (https://kdp.amazon.com/en_US/select):
When you choose to enroll your book in KDP Select, you're committing to make the digital format of that book available exclusively through KDP. During the period of exclusivity, you cannot distribute your book digitally anywhere else, including on your website, blogs, etc.
Related: If you include a link in an ePub to any other retailer, the book will be rejected by Amazon.