The moral defense for the terror unleashed by the nuclear bombs is that countless lives (of Allied soldiers) would be saved if an invasion of the Japanese home Islands became unneccessary.
Unfortunately, that defense is nullified, by something else happening, that the American government had full knowledge of.
What did they know?
They knew that the long requested Russian declaration of war on Japan was about to happen. This suggests that there were other reasons for using the atomic bombs.
They could be:
1. The American high command wanted to see what the bomb would do when used on a civilian population.
2. They wanted to demonstrate the bomb to the Russians, sort of, "Look what we've got?" This argument is dependent on being able to show that the USA was already re-considering their relationship with the Soviet Union. It can be argued that the success of Russia's final drive on Germany concerned the USA.
But back to the very short Russian-Japanese war.
The first nuclear bomb was dropped on August 8, but the planning for the Russian-Japanese war had commenced 3 months before, and shortly after the defeat of Germany. Train load after trainload of Military gear had been sent to Siberia and the huge Russian bases that were prepared for the Invasion. The USA knew something of those preparations, at the very least.
On August 8, the Russians declared war on Japan, and invaded Japanese held Manchuria and the islands to the north of Japan in three great pincer movements. In little more than a week Russian forces had wiped out the occupying Japanese Army in Northern China, Korea and the Japanese section of Sakhalin Island.
They also were preparing to invade the large northern Japanese Island of Hokkaido.
Faced with a choice of surrendering to the United States or the Soviet Union, the Japanese elite chose the soft touch and were rewarded for their choice.
If you want to know more I suggest this Foreign Policy overview as a starter: