Depending on the year, I'd confirm make and sure you diagnose it is the fuel pump before purchasing installation.
If there is no CEL light or DTC's, I'd check the crank position sensor first depending on the year. I had my 2006 LS completely die after warm up with no CEL or DTC.
Start and run fine after warm up and completely stall / die. After it was cold I could start it and run it until it warmed up again.
A bad CKP sensor is cheap and easy to diagnose - just GM PCM is weird about no CEL light. It's $25 at parts store, and you only need to remove the starter.
But it makes sense - without a good crank sensor signal the computer has no way of telling the motor when to fire plugs at all on the 2006 2.2 Ecotec's.
Newer models might use a cam sensor of some sort to tell the PCM exactly when to fire the spark plugs, Coby7 would be the one who knows - he is the jedi master on Cobalts and has helped me greatly in the past
I just had to pay a shop to replace a CKP sensor that it took them 10 days to diagnose with Chevy dealership guys trying to help. It was because after I had a new clutch installed at a tranny shop they rerouted the wiring harness so it was shorting out on the block and metal AC lines - blowing fuses and CKP sensor connector was faulty.
But I have the same issue before, car starts up and runs fine until warmup, then it stalls and won't restart until it is cold. I replaced the CKP sensor on my Cobalt myself about 2 years ago and this fixed it after I tried a fuel filter, coil packs, and ignition module.
Long story short I'd confirm fuel system diagnosis before repair could be something easy (check that pump turns on and fuel system is pressurized). Fuses need to checked of course and pump is receiving voltage to turn itself on.