That's an excellent question and one I've asked before.
War is a brutal numbers game. Using the bombs was likely going to result in the lowest overall death toll and that's exactly what happened. I won't say it wasn't awful, but so is just about every other act of war. eg, its awful to stick your bayonet into some 18 year old kid's belly and watch him scream in pain and die in agony. The bombs were necessary and they ultimately saved a lot of lives. As such, using them was the moral thing to do.
War is hell, and there will always be civilian casualties.