When Instagram first debuted in 2010, one single server powered the photo-sharing service.
Now, after being bought by Facebook in 2012, Instagram runs from its parent’s massive data centers containing thousands of machines, explained Instagram co-founder and chief technology officer Mike Krieger on Thursday during the Structure business technology conference in San Francisco. The powerful infrastructure lets Instagram’s millions of users share photos and post comments without overloading the service.
During the days when Instagram was operating on a single server, Krieger said that his small staff spent about 90% of their time building the product and 10% of their time trying to operate things smoothly. As the service grew in popularity, the team needed more servers to keep the website running. But Krieger explained that it took around four days to properly set up a server for Instagram’s needs.
“That was awful,” he said.
To speed things up, Krieger and his team turned to Amazon and its cloud computing service, which lets companies buy computing resources on demand. However, many of Amazon’s (AMZN) various cloud computing services were still being developed, such as offering companies access to Amazon’s solid state drives, which can boost a website’s performance.
Krieger said he used to joke that Instagram was always two weeks away from falling apart until Amazon introduced a new service that would keep it alive. It should be noted that Amazon’s cloud computing service has matured since then, and last quarter had $1.8 billion in sales.
After Facebook (FB) bought Instagram for $1 billion dollars, the social network wanted Instagram to move from Amazon to Facebook’s data centers, which Krieger said took a year and a half. During that time, he read about corporate acquisitions and discovered that it was a bad sign if the buyer immediately forced its new sibling to adopt its technologies.
In the end, Facebook didn’t immediately require Instagram to set up shop in its data center, Krieger said. Facebook’s vice president of engineering, Jay Parikh, “put the fear of God into all the infrastructure folks” to not push anything too quickly on Instagram’s staff, Krieger said.
Now as part of Facebook, Krieger said Instagram can take advantage of Facebook’s data centers around the world as well as the social network’s internal tools, like spam fighting software. Krieger claims that Instagram operates more efficiently on Facebook’s infrastructure, and Parikh said later during the conference that Instagram now used one Facebook server for every three Amazon servers they once used.
Additionally, Instagram is now close to the Facebook team that is involved with the Oculus virtual reality technology, Krieger said. He hinted that Instagram is exploring virtual reality given its proximity to Facebook’s VR team.
“I’m fascinated to be somewhere different in Instragram,” said Krieger about the possibility of using virtual reality to make Instagram’s photos more lifelike.
Subscribe to Data Sheet, Fortune’s daily newsletter on the business of technology.
For more on Instagram, check out the following Fortune video: