Bank of America has bucked the Wall Street trend by building its own private cloud software rather than outsourcing to companies like Amazon, Microsoft, and Google.

The investment, including a $350 million charge in 2017, hasn't been cheap, but it has had a striking payoff, CEO Brian Moynihan said during the company's third-quarter earnings call.

He said the decision helped reduce the firm's servers to 70,000 from 200,000 and its data centers to 23 from 60, and it has resulted in $2 billion in annual infrastructure savings.

Visit Business Insider's homepage for more stories.

Wall Street CEOs relish proving their critics wrong — and Bank of America's Brian Moynihan is no exception.

Discussing the bank's third-quarter earnings results on Wednesday, Moynihan didn't hesitate to point out that many of the analysts on the call had doubted the company's capacity to shave billions off of its annual expenses.

He said: "2.5 years ago, we said we'd operate this year on $53 billion and change in expenses, and we hit that number — and a lot of you had us in at $57 billion."

How did Bank of America do it? The company has made massive bets on technology that have had a striking payoff, including billions in annual savings, Moynihan went on to explain.

The bank, which has a $10 billion annual tech budget, has made an array of tech investments across its wide-ranging divisions — chatbots, automated mortgages, improvements to its mobile app — but Moynihan specifically highlighted the firm's decision to buck the Wall Street trend and build out its own internal cloud architecture rather than shelling out millions to public-cloud companies like Amazon, Microsoft, and Google.

This effort, which initially began in 2013, didn't come cheap. Moynihan reminded analysts the bank took a $350 million charge in 2017 in part to execute the changeover to its private cloud.

But the results have been dramatic. The company once had 200,000 servers and roughly 60 data centers. Now, it's pared that down to 70,000 servers, of which 8,000 are handling the bulk of the load. And they've more than halved their data centers down to 23.

"We reduced expenses by basically around 40%, or $2 billion a year, on our backbone," Moynihan said, adding that they've simultaneously seen their transaction load balloon.

Read more: Bank of America wants to dominate middle-market investment banking. Here are the new teams, hires, and cities it's adding to make that happen.

The new, more operationally lithe Bank of America is up 86% in mobile logins and 39% in wire transactions, while digital payments have climbed 29% to $424 billion compared with the third quarter of 2017. And the list goes on.

Howard Boville, Bank of America's chief technology officer, told Business Insider this summer that the bank would save $2.1 billion in infrastructure costs in 2019, a large part of which comes from moving a majority of its workloads from traditional on-premise servers to its private cloud.

Shayanne Gal/Business Insider

Here's how Boville explained the cloud's benefits and cost reductions to Business Insider:

A private cloud essentially uses software to lash together existing data center hardware into a single unified platform — making more efficient use of each individual server, while also making it easier for developers to access and scale up their resources.

...

It's not just cost benefits Bank of America has recognized from the move to its private cloud, Boville said. The bank also has a better sense of its client interactions — of which on the consumer side there are 26 million daily. Everything from a customer's ATM card not working to a credit-card transaction taking slightly longer to be approved is monitored.

Right now, the bank estimates its private cloud is 25 to 30% cheaper than public providers, though it also recognizes that probably won't last forever. Still, the company believes the architecture it has built will give it leverage in negotiating contracts with these companies — a process that is already under way, Moynihan said.

"But so far, we're still cheaper, and so far, we have to make sure that the external providers are safe, sound, leave the data just for us to use for our customers, don't mix with other people's data, etc.," Moynihan said. "And that discussion, negotiation, goes on as we speak."

Bank of America's peers haven't been as forthcoming on what they're spending on cloud services, prompting Mike Mayo, an analyst with Wells Fargo, to thank Moynihan for "providing data that others have not provided yet."

Moynihan's transparency is laudable, though, of course, it's easier divulging details when it involves revealing billions in savings and proving your critics wrong.