Connecticut missed the cut for the 20 finalists to get a second headquarters of Amazon, with New York City, Boston and Newark, N.J., still in the mix.

Amazon expects to make a final decision by the end of 2018. The company plans to invest $5 billion and create as many as 50,000 jobs in the city it selects, envisioning it as a full-fledged equal to its headquarters office in Seattle.

Connecticut Gov. Dannel P. Malloy’s administration had pushed a joint proposal for Stamford and Hartford as headquarters sites, with Bridgeport and New Haven also submitting a pitch among 238 areas nationally that recruited Amazon.

Other finalists include Atlanta; Austin, Texas; Chicago; Columbus, Ohio; Dallas; Denver; Indianapolis; Los Angeles; Miami; Montgomery County, Md.; Nashville, Tenn.; Philadelphia; Pittsburgh, Pa.; Raleigh, N.C.; Toronto; northern Virginia; and Washington, D.C.

In a statement, Amazon termed “very tough” winnowing the list of candidate cities to 20, and stated the company will put to use about what it learned in any future expansions.

While Amazon has made major investments in Connecticut distribution centers in the past decade, the headquarters proposals had been deemed a long shot, given the existing selection of available buildings and land and other challenges the state faces including traffic congestion on its highways and the distances to major airports.

The state’s proposal touted 1.3 million square feet of space in three Stamford office buildings as immediately available, with another nine parcels of land able to accommodate an additional 6 million square feet of space.