Made by Samsung, the batteries are meant to store enough energy to serve as a backup in cases of fuel shortages. They are also designed to absorb low-cost energy, particularly solar power, during the day and feed it back to the grid after dusk. They in effect can fill in for the decades-old gas-fired plants that might lack the fuel to fully operate because of the disastrous leak.

“California is giving batteries the opportunity to show what they can do,” said Andrés Gluski, chief executive of AES, which is installing the storage systems.

AES is installing a smaller array for the electric utility in El Cajon, a suburb east of San Diego. And separately Tesla, the company perhaps better known for its electric cars, has built an array for a different utility on the grid, Southern California Edison, near Chino, Calif.

The stakes are high for both energy storage companies. If their projects struggle or fail, it could jeopardize not only the stability of Southern California’s grid but also interest in the technology over all.

After a smaller, but pioneering battery project at a wind farm on Oahu in Hawaii went up in flames in 2012, investment in battery storage all but dried up for a few years. That installation, which used 12,000 lead-acid batteries to help even out fluctuations in the power flow, caught fire three times in its first 18 months of operation. The storage developer, Xtreme, eventually went bankrupt. The wind farm turned to a different technology to smooth its output.

Keeping a close eye on the Southern California battery efforts is Susan Kennedy, who helped shepherd California’s energy policy for more than a decade as a state utility regulator and high-level operative for two governors — Gray Davis, a Democrat, and Arnold Schwarzenegger, a Republican. She now runs an energy storage start-up, one not involved in the battery-building response to the Aliso Canyon gas leak.

“The moment one fails,” Ms. Kennedy said of the big bet on batteries, “they won’t build any more.”

As soon as AES’s chief executive, Mr. Gluski, learned last June that San Diego Gas & Electric had awarded AES the big battery contract, he leapt out of his chair and interrupted a meeting in his board room at the company’s headquarters in Arlington, Va. As employees watched in astonishment, he barreled down two flights of stairs, grabbed a mallet and, with a ceremonial flourish, banged a gong that one of his executives kept on hand for big news.