Take the 400K salary job for a year or two. Pay off your debt and keep working on your business on the side. Of course, you may need to be transparent with your friend about it.
I am all for risk taking but it should be "calculated". It seems like you are in serious risk of going off the cliff because lets face it, an AWS mistake wiped off your runway so it means you don't have a lot of it to play with.
So yea, take the 400K job, keep working on your stuff on the side and once you have some breathing room, get back to it fulltime in a year or so.