Had they done that in World War 1, there likely wouldn't have been a World War 2. The greater good would have been accomplished by killing a few million to save 100 million. The US made the same ethical decision when deliberating on what to do to end World War 2, a decision that would never had been made if the war hadn't started to begin with.
That's not something I advocate because I'm not God and don't claim to be. That is however, and was, common practice in ancient history. Leaving survivors meant leaving angry generations of people that would one day seek to take revenge. That's also why a king and his heirs were all killed after a victory or coup to a throne. You don't have to agree with it, but the reasoning is sound, not to our culture, but to theirs. Israel didn't go in and kill everyone in the land. They let some survive, and made treatise with some peoples as well, which led to centuries of trouble and wars from the descendants of those same people. More died by the hands of the descendants than the numbers that would've died in the beginning of the "genocide". It's a greater good argument.
When it comes to ethics on the greater good, every side is biased and suspect because the question arises, "who gets to make the claim that their greater good is better than someone else's?" The answer, historically, is "he who has the greatest might, has the greatest right." Power determines the right. The two points I leave with you are:
1. If the Bible is true, then an all knowing God acted is such a way to accomplish a greater good, one known to him but not to his followers at the time.
2. If the Bible is false, which most claim, then you're arguing over something that didn't happen anyway and wasting your life debating fairy tales.
There's my 2 cents...now bring on the lynchings! lol