Like thousands of others, Megha Mathur movedto the Indian city of Gurgaon for acoveted job in tech. She soon realized she wouldn’t be able to live there very long. The pollution was so bad she had to check an air quality app on her phone several times a day to see whether it was safe to go outside without a mask.

“Having to live like that can cause a lot of anxiety and stress in knowing that’s constantly your life,” Mathur, 27, told CNN Business. “Even though there are exciting opportunities in terms of companies and jobs, it just wasn’t a place that I could see myself living long term and I think a lot of people share that opinion.”

Gurgaon, around 25 miles from India’s capital New Delhi, is one of the country’s newest tech hubs — home to global players such as Google (GOOGL) and Microsoft (MSFT) as well as some of India’s biggest startups like food delivery firm Zomato and India’s biggest hotel chain OYO. Mathur, who worked for Zomato, stayed there only nine months before moving with her fiancée Harshvardhan Singh to the southern city of Bangalore.

“If you want to work in tech then Bangalore is your number one choice,” says Singh, who left OYO for Flipkart, India’s top online retailer that was bought by Walmart (WMT) last year. Often described as India’s Silicon Valley, the city is also the main India base for Amazon (AMZN), Flipkart’s main rival, the birthplace of ride-hailing firm Ola and home to leading outsourcing companies such as Infosys (INFY) and Wipro (WIT).

Gurgaon and Bangalore have exploded in the past two decades as the maincenters of India’s tech boom, with millions like Mathur and Singh taking up the highly prized and well paid jobs that come with it. The cities underscore one of the main dilemmas the country faces: The rapid growth needed to drive its $3 trillion economy and sustain 1.3 billion people has spawned an environmental emergency.

India’s energy needs are rising as it tries to extend the manufacturing and tech boom to lift millions moreout of poverty.That means more factories, more offices, more residences and vehicles.

The country has set itself ambitious targets since signing the Paris Climate Agreement, aiming to source 40% of its energy from renewable sources like wind and solar by 2030. There has been significant progress — renewable energy now accounts for nearly 23% — but India is still one of the world’s largest oil importers, and more than half of its electricity still comes from burning coal.

A perfect storm

When Sanjay Gupta and his family first moved to Gurgaon in 1999, there was hardly anything around. “It was sparse, desolate, and for most requirements we would have to go to Delhi,” he said. “It was a distance away from everything that we needed.”

Gupta, who worked for American Express, soon moved overseas for stints in New York and Singapore, before returning to Gurgaon as the company’s India head in 2006. By then the tech frenzy was firmly underway. “You always felt that you were in a construction war zone,” says Gupta, now the CEO of AI education startup EnglishHelper.

Today, the drive into Gurgaon — now officially known as Gurugram — is a blur of glass buildings and company logos. It’s now one of India’s fastest-growing citiesbut mostly makes headlinesfor having the world’s most toxic air, based on an index compiled by Greenpeace and AirVisual that measures the level of fine particulates.

As recently as the first week of November, Gurgaon and neighboring New Delhi were blanketed by a layer of smog so thick that officials declared a “public health emergency,” dozens of flights were canceled and schools were closed.Traffic pollution and construction dust are partly to blame, but the annual burning of crop waste by local farmers makes the situation worse at this time of year.

It’s a public health crisis that resurfaces every winter, thanks to whatexperts refer to as a “perfect storm” of pollution. And it only seems to be getting worse.

People wearing pollution masks have become an increasingly common sight in Gurgaon. (Ruhani Kaur/Bloomberg/Getty Images)

“Gurgaon had an opportunity to make this a world class city and we are nowhere close to it,” says Latika Thukral.

A former Citibank executive, Thukral quit her job in 2004 and co-founded I Am Gurgaon, a citizen’s group that has been working to increase the city’s green cover, clean up its water supply and create more open spaces.

“I think the exodus is happening,” Thukral says. “There will be no water, pollution is at its peak. Why would people not move out?”

Bangalore’s tech boom preceded Gurgaon’s and its transformation was even more dramatic. The city, now officially called Bengaluru, used to be dubbed “Garden City” or “Pensioner’s Paradise.” Not any more. Where Gurgaon has poisonous air, Bangalore has gridlock — the number of vehicles in the city has gone from around 1.4 million in 2000 to more than 8 million this year.

Singh’s four-mile commute in Gurgaon used to take him around 15 minutes. In Bangalore, his five-and-a-half mile journey to work usually takes close to an hour. The longest he can recall is two and a half hours.

He also says it’s not uncommon at Flipkart for people to email colleagues in the morning saying they’re working from home because there’s just too much traffic, or there were no ride-hailing cabs available.

“The biggest worrying factor seems to be that there seems to be no immediate solution,” he says. “The city seems like it was built for 10 people and we’ve put in 10,000.”

According to estimates last year from the Japan International Cooperation Agency, which is helping build a system to ease Bangalore’s traffic woes, the average speed on the city’s roads during the morning rush is just 8 miles per hour.

“The biggest challenge which Bangalore is facing now is that of unbridled growth,” the city’s municipal commissioner B.H. Anilkumar told CNN Business.City authorities are thinking about introducing bus lanes andeven a London-style congestion tax to ease the pressure on roads, he said. But those will take time to put in place.

Bangalore’s higher elevation and moderate climate mean it doesn’t get blanketed by smog like Gurgaon and Delhi. However, multiple independent studies from recent years have said transportation is the biggest source of harmful emissions in the city — contributing about 40%.

Running out of water

Both cities have another huge problem in common — they’re using up water faster than it can be replenished.Their populations are projected to more than double over the next decadeafter rapid expansion in recent years, further straining already maxed-out infrastructure. Gurgaon and Bangalore (and 19 more Indian cities) will run out of groundwater next year, according to estimates by government-run think tank NITI Aayog.

“Industrial growth in and around cities will be severely compromised as companies will move their operations to more water-secure locations,” the think tank said in a recent report.

Millions already rely on private water tankers because government supplies are often inadequate. Bangalore’s groundwater usage is running at 143%, according to the latest government data, meaning it’s consuming more every year than comes from rain and runoff. For Gurgaon that number is 220%.

“If you look at the map of Gurgaon in the 1970s and trace out the rivulets… it’s like a web,” says M.D. Sinha, a senior official at the city’s metropolitan development authority, the GMDA. “Now you trace it and you’ll see that a lot of these have become roads.”

Millions in India's big tech cities depend on private water tankers because government supplies are inadequate. (Manjunath Kiran/AFP/Getty Images)

Set up in 2017, the GMDA is focusing on recycling water and setting up sewage treatment plants. “Water… can be viewed as both a waste and a resource,” says Sinha, who heads the city’s conservation efforts. “It is now being viewed as a resource, and that is the shift we need for all our resources. We need to understand that we must save it or it will destroy us.”

Getting involved

Companies that rode India’s tech boom know they have to pitch in because the future of their business may depend on it.

“If some things are not done or a lot of things are not done, can it get worse? Yes, it can absolutely can get rapidly worse so it is important that everybody gets with it,” says Aditya Ghosh, a member of OYO’s board. (Ghosh was OYO’s India and South Asia chief until Dec. 2 when he was succeeded in that role by Rohit Kapoor.)

OYO, which operates over 20,000 hotels across 80 countries, is in the process of moving to a bigger headquarters in Gurgaon. Ghosh says the company has tried to make its new office sustainable, ensuring proximity to public transportation, creating larger open spaces to reduce the need for air conditioning and lighting, and cutting down paper and plastic use. It is making similar efforts in its hotels to promote recycling, waste management and rain water harvesting.

OYO’s current office has 3,000 employees across eight floors. The new office will accommodate those employees across five floors. “Every time you add that next floor you’re actually leaving behind a bigger footprint,” Ghosh says.

More than 1,300 miles south in Bangalore, Flipkart and Amazon are locked in a race to reduce their impact on the environment, even as they fight for top spot in India’s online retail market. Flipkart announced in late August that it would eliminate single-use plastic packaging from its supply chain by March 2021. Amazon said a week later that it would do so by June 2020. The companies are testing out alternatives made of paper, cardboard and other recyclable materials. Flipkart has also started collecting plastic packaging materialfrom customers so it doesn’t end up in landfills.

Both companies also say they’re trying to reduce the amount of packaging each delivery requires and the carbon footprint of their vehicles. “If I was to compare last year versus this year, we have doubled the number of customers who have received more than one item in one box,” says Akhil Saxena, Amazon India’s vice president of operations.

India's top online retailers are on a mission to increase the amount of recycled material in their packaging. (Manjunath Kiran/AFP/Getty Images)

The US company has installed solar power and rainwater harvesting technology at several of its warehouses, as well as motion sensing lights that switch off as soon as workers exit. Flipkart says it has over two dozen warehouses with an ISO 14001 certification, a global standard that rates companies on how well they manage energy consumption, water usage and waste management.

Amazon CEO Jeff Bezos pledged in September that the company would become carbon neutral by 2040. India poses a particularly large challenge. “I think if we do get off to a good start in a sustainable manner then the scale up becomes much easier,” says Saxena.

As part of its September pledge, Amazon said it would have 100,000 electric delivery vehicles in operation worldwide by 2023. But the company hasn’t yet revealed how many of those will be deployed in India. Walmart-ownedFlipkart has already begun using electric delivery vehicles and says 40% of its fleet will be electric by March next year.

Amazon India uses recycled water at its Bangalore headquarters and at its new campus in Hyderabad — Amazon’s largest office building in the world. The company also partnered with a local NGO, city authorities and several other tech firms to help fund and construct a sewage treatment plant at one of Bangalore’s dozens of lakes.

Flipkart says it has eliminated single-use plastic inside its Bangalore headquarters, which currently accommodates around 8,500 employees, by using alternative materials like stainless steel and glass. The e-commerce firm says the amount of waste it produces has gone down despite its rapid growth. Flipkart executive Mahesh Pratap Singh, who became the company’s first head of sustainability earlier this year, says raising awareness among its thousands of employees has had a wider impact on the community.

“When you do something at this scale… it goes back to their homes,” Singh told CNN Business.

No time to lose

While some of the biggest names in tech and finance are committed to solving India’s environmental crisis, there’s much more to be done. When it comes to fighting India’s pollution, congestion and water shortages, the country’s lack of infrastructure can be a challenge.

Amazon’s Saxena says it’s harder to procure plastic substitutes like wood and paper in India in large enough quantities than in more mature economies, and the fact that most deliveries take place on motorcycles rather than vans or trucks means the packaging has to be a lot more flexible and adaptable.

“It’s not like a cut paste copy because the contexts are different, the environment is different, the infrastructure is different,” Saxena adds.

Simply put, it’s tough for companies in India to keep pace with its growth and drastically reduce their carbon footprint at the same time.

“We are at a stage where we’re figuring out mass scale alternatives we can actually take to people,” says Singh, Flipkart’s sustainability head.Flipkart is having to design custom electric vehicles from scratch with a local startup because there aren’t viable options locally.

Ghosh at OYO says companies only really start changing the way they behave when two things happen:“When consumers demand it more — and consumers have started demanding it more — and secondly when the cost of technology needed to make it happen also starts coming down.”

Gurgaon is consistently ranked among the world's most polluted cities, and the crisis appears to be getting worse. (Chandan Khanna/AFP/Getty Images)

The companies all acknowledge the sense of urgency and the enormity of the problem. Time is running out.

“While leadership companies have begun to factor sustainability thinking (including climate change) into their business strategies … the process clearly needs to be deeper, wider, and faster,” Shankar Venkateswaran and Mukund Rajan, former heads of sustainability efforts at Indian conglomerate Tata, wrote in “India and a Warming World”published earlier this month.

Mathur, who now works at Indian e-commerce startup Meesho, says she prefers Bangalore to Gurgaon. But that hasn’t stopped her from worrying completely, and she says she feels “exceptionally” lucky that her building has a reliable water supply, at least for now.

“For a lot of people that live in Bangalore … there are massive water outages. That is becoming more and more real and I imagine over the next couple of years that will become a big part of our lives as well,” she adds.

As the water runs out, plastic waste piles up and the air gets ever more toxic, everyone has to do what they can.

“You can be despondent that this is never going to be enough but you have got to take those small steps and believe that can make a difference,” Ghosh says.

— Esha Mitra contributed to this report