SAN FRANCISCO — Business leaders in Tucson have tried to mail Amazon’s chief executive, Jeff Bezos, a 21-foot cactus. The largest conference room in the Tulsa, Okla., mayor’s office has been converted to a war room, with 50 volunteers poring over videos of Mr. Bezos.

In Philadelphia, hundreds of Wharton Business School students have a new fall semester assignment: Pitch the city to Amazon. And the mayor of Ottawa flew to Seattle last week to walk as close to Amazon’s headquarters as is publicly accessible.

“It’s like ‘The Amazing Race,’” said Jim Watson, the mayor of Ottawa. “You’ve got this cast of characters running toward the Holy Grail.”

Amazon, on the hunt for a place to build a second headquarters, where it plans to invest $5 billion and create 50,000 jobs, has begun an enormous competition among cities across North America. With a loose set of requirements like proximity to an airport and walkability, the e-commerce behemoth has set officials on a journey to sell their towns, with the aim of getting in on what some are calling one of the largest economic development deals of the century.