President Donald Trump had personally ordered then-Defense Secretary Jim Mattis to not give Amazon a fair chance to bid on a massive cloud computing contract to the Pentagon, according to a new book by Mattis' one-time aide Guy Snodgrass. The $10 billion Joint Enterprise Defense Infrastructure (JEDI) contract was awarded to Microsoft on Friday, a major loss for Amazon and its CEO, Jeff Bezos.

Snodgrass' book, "Holding The Line: Inside Trump's Pentagon With Secretary Mattis," alleges that Trump told Mattis to "screw Amazon" out of receiving the contract in the summer of 2018.

"We’re not going to do that," Mattis had told Pentagon officials, according to Snodgrass' book. "This will be done by the book, both legally and ethically."

Trump has openly lambasted Amazon and Bezos, claiming that the e-commerce giant takes advantage of the United States Postal Service and pays little to no taxes to local and state governments. He has also frequently criticized the Washington Post, which is owned by Bezos, for its reporting on his administration.

But Trump wasn't the only obstacle that Amazon faced in its contract bid. In August, the Pentagon decided to put a pause on the bidding process due to concerns that it was rigged in favor of Amazon. Oracle has also previously filed a lawsuit, claiming that there was a conflict of interest during the procurement process, but it was dismissed by a judge in July.

Amazon Web Services (AWS), Amazon's cloud computing platform, had been used by the government before. The CIA signed a deal with AWS in 2013.

The JEDI contract will entrust Microsoft with the task of updating the Pentagon's aging computer networks and replacing it with a single cloud platform. Microsoft will also have to assist the Department of Defense in other areas, such as in artificial intelligence.