Amazon has been one of President Trump's favorite targets on Twitter.

He's accused the company of not collecting taxes (which it does), charged it with putting retailers out of business — and focused his attacks on the tech company's relationship with the Post Office.

So, the President might be surprised to learn that one of Amazon's biggest customers is, in fact, the federal government. Amazon's relationship with the government goes well beyond delivering packages — to playing a vital role in protecting America's national-security secrets.

While Amazon still makes most of its money selling stuff online, a growing part of the company's business is storing stuff in the cloud.

Amazon Web Services, or AWS, sells its cloud services to lots of companies, and increasingly to the government. Agencies from the Smithsonian to the CIA have awarded contracts to AWS.

CIA Chief Information Officer John Edwards lavished praise on the company at a conference last year.

"It's the best decision we've ever made," Edwards said. "It's the most innovative thing we've ever done; it is having a material difference or making a material difference and having a material impact on both CIA and the IC."

For the IC (the intelligence community) and the CIA to trust Amazon with their data — and their secrets — is a big deal in government-contracting circles.

Daniel Ives, chief strategy officer and head of technology research at GBH Insights, said Amazon Cloud Services is a growing part of the company's overall business, thanks, in part, to its pursuit of government contracts.

"Amazon has strong tentacles into the federal government on AWS," Ives told NPR. "A number of years ago, they were basically background noise, but they've really become the key cloud player in the government."

Ives estimates Amazon could have $3 billion to $4 billion worth of business with the government annually in the next few years.

That business could grow even more if the company is successful in winning a big contract with the Pentagon to host its data. The contract, called the joint enterprise defense infrastructure or JEDI, could be as much as a $10 billion deal for whomever wins it.

And that's why Amazon's success with the CIA is so important.

At a recent congressional hearing, Defense Secretary James Mattis said the Defense Department has "over 400 different basic data centers that we have to protect, and we have watched very closely what CIA got in terms of security and service from their movement to the cloud," adding, "It's a fair and open competition."

Still, Chris Cummiskey, a senior fellow at the George Washington University Center for Cyber and Homeland Security, said Amazon may have an advantage, which has competitors like Oracle, Microsoft and others upset.

"There's concern in the industry that if it's a sole-source award, which is basically what they're talking about — awarding to a single company," Cummiskey said, "that that would be not good for competition, not good for security, and not good for the overall health of the competitive market place."

A wild card for Amazon's future as a government contractor is whether President Trump continues to attack the company, Ives said.

"I think it's going to be very interesting to see if their meteoric rise within the federal government on the cloud side continues, in light of some of the issues that they've run into with the Trump administration," he said.

Copyright 2018 NPR. To see more, visit http://www.npr.org/.