Walmart Inc. (WMT) is making inroads against Amazon.com Inc. (AMZN) in e-commerce and it has cloud computing to thank.

At a time when retailers are leveraging digital data to customize the online shopping experience for consumers in hopes of standing out, Walmart is taking a page from its biggest rival by spending money to create an in-house cloud computing offering that includes six server farms, each bigger than 10 football fields in size, reported Reuters. The cloud initiative took Walmart close to five years to build and cost millions of dollars, according to Reuters. With it, the retailer is able to crunch the data on its millions of consumers providing better service and boosting its e-commerce sales. (See also: Goldman Sachs Gives Wal-Mart a Thumbs Up.)

While a lot of retailers outsource their cloud computing needs, Walmart is copying Amazon by keeping it in-house and the move appears to be paying off. It enables the company to stay in lockstep with the Seattle-based online retailing giant on pricing and target shoppers more accurately, the holy grail for online merchants. Reuters noted that Walmart can now change prices at stores near instantly. In an interview with Reuters, Tim Kimmet, Walmart's head of cloud operations, said the in-house server farms enable the company to grow faster on the e-commerce side with it using its cloud, for example, to stock items that customers typically order using Google Home and other voice-activated devices. The cloud is also helping it improve customer service with data from customers’ purchases enabling it to quicken the process for returning items at stores by 60%.

Secrecy and Security

Kimmet told Reuters that another motivating factor for building the cloud computing capability in-house was security. He said that the cloud, and thus the data, remaining internal enables it to better protect its customers’ personal information. After all, a data breach can shake customer confidence, hurting a retailer’s reputation and resulting in lost sales. Walmart is keeping the location of its server farms secret, underscoring its focus on security, noted the report.

While Walmart is the world’s largest physical retailer, when it comes to online shopping in the U.S., it accounts for only 3.6% of the share, according to research firm eMarketer. By comparison, Amazon controls 43.5% of e-commerce in the U.S. But Walmart is making some gains against Amazon as it proves it can compete with its tech-savvy rival. In addition to its cloud efforts, the company is offering more products online, provides free two-day shipping and in-store pickup and returns and is looking to expand its offering of products that are $10 and above to increase its online profits. The latter move is a bit of an about-face for Walmart which had long focused on low-priced items.