When the Pentagon first tendered the so-called Jedi contract in March 2018, the stakes couldn't have been higher.
The Joint Enterprise Defense Infrastructure project would give the military a cloud computing system that could handle 3.4 million demanding users, many of whose lives depended on it working correctly.
Rather than share the responsibility between several companies - as the likes of Oracle and IBM had keenly hoped - the Department of Defense decided that this was to be a "winner takes all" contract. One project, one provider, $10bn (£7.6bn).
Experts considered it an opportunity beautifully "gift wrapped" for Amazon. Its Amazon Web Services (AWS) was already, by far, the biggest cloud platform in the world, entrusted with sensitive data belonging to millions of clients. Among them, the Central Intelligence Agency.
"We have no favourites," insisted Timothy Van Name, from the Defense Digital Service, when hit with a barrage of criticism from the wider cloud industry. A court challenge would come from Oracle - the database firm - slowing progress, but the contract looked set to land in the lap of Jeff Bezos.
Except, it didn't. Against expectations, the Department of Defense awarded the contract to Microsoft.
Now, Amazon is going head-to-head with the Trump administration, arguing that the President himself unfairly interfered with the selection process out of spite for Jeff Bezos due to his ownership of the Washington Post.
So far in 2019, AWS has generated $25bn in sales, generating more income for Amazon than it makes from retail in the whole of North America.
In that context, the Jedi contract - worth $10bn over 10 years - would be a meaningful but not critical entry on its balance sheet.
But what has Amazon so incensed is what the Pentagon's decision might mean for future, similar contracts. Much like the firm had hoped its involvement with the CIA would give it a shoe-in for Jedi, it is thought that other US departments, also in need of modernisation, will follow the Pentagon's lead.
Dan Ives, an analyst with Wedbush, said he believed Amazon's protest would not result in the overturning of the Jedi decision. And, as a result, Microsoft - which today controls 17% of the cloud market - would be poised to capitalise.
"This is a game-changer for Microsoft," Mr Ives said in a briefing note, "as this will have a ripple effect for the company's cloud business for years to come, and speaks to a new chapter of [Microsoft] winning in the cloud v Amazon".
With more than $1tn in cloud spending predicted in the upcoming decade, this initial $10bn loss could ultimately prove incredibly costly. A "stinging defeat", as Mr Ives put it.
Jeff Bezos's problems began to emerge in July, when President Trump told reporters that he'd heard "people" were unhappy with the way the Pentagon contract had been handled.
Among those people were executives at Oracle, who had been aggressively lobbying the president, arguing the decision to award Jedi to just one company amounted to a "conspiracy" that would create a cloud monopoly, leaving Oracle out in the cold.
"I'm getting tremendous complaints about the contract with the Pentagon and with Amazon; they're saying it wasn't competitively bid," the President said.
"I will be asking them to take a look at it very closely to see what's going on because I have had very few things where there's been such complaining."
On 1 August, it was announced the decision on Jedi had been put on hold. The new Defense Secretary, Mark Esper, said he would re-examine the process, though later recused himself after it emerged his son had worked for one of the companies in the running, thought to be IBM (which, at this point, had already been eliminated).
On 25 October, Jedi was awarded to Microsoft. Amazon was furious. Last month the firm filed an appeal in federal court, details of which were unsealed by a judge this week.
Amazon said the Pentagon's decision came not through a fair assessment of capabilities, but was "the result of improper pressure from President Donald J Trump, who launched repeated public and behind-the-scenes attacks to steer the Jedi contract away from AWS to harm his perceived political enemy - Jeffrey P Bezos".
President Trump has made his dislike of Amazon repeatedly clear.
Before being elected, he told supporters on the campaign trail he would give Amazon "problems", and described the firm as using "our postal system as their delivery boy (causing tremendous loss to the US)".
A Vanity Fair report in April 2018 suggested Mr Trump was, now that he's in the White House, prepared to use his power to thwart Amazon's advances. An unnamed source "close" to the administration is quoted in the article as saying: "Trump is like, how can I f*** with him?"
Mr Trump's dislike of Mr Bezos stems from the world's richest man - that's Mr Bezos - having ownership of the Washington Post newspaper, a major thorn in the side of the President. While that ownership was a personal investment by Mr Bezos, rather than Amazon, Mr Trump sees no distinction, repeatedly referring to the revived newspaper as the "Amazon Washington Post".
In tweets, Mr Trump called the Jedi contract a "Bezos bailout". His son, Donald Trump Jr, also tweeted that Amazon was engaging in "shady and potentially corrupt practices" that "may come back to bite them".
In its filing, Amazon said these interferences "destroyed" the ability for the Pentagon to be impartial in its decision making.
"Each of these messages came while [the Department of Defense] was evaluating the Jedi proposals and it would have been virtually impossible for anyone involved in Jedi to ignore them."
According to news agency AFP, the legal tussle will not slow progress on the project.
"We will deal with Amazon's legal actions. I can't comment on those right now," said Under Secretary of Defense for Acquisition and Sustainment, Ellen Lord, on Tuesday.
"But I will tell you we are moving right now forward with the Jedi contract."
Source : BBC