Hiroshima was the answer to a trolley problem: destroy a good part of an industrial city with tens of thousands of civilian deaths, demonstrating the power to obliterate Japan if their government did not surrender, or invade the mainland resulting in hundreds of thousands of civilian casualties and many US infantry casualties. Not to mention the horrors that partial Stalinist USSR occupation would have brought on the people of Japan, with the complex and deadly political splits that we saw play out in Germany and Korea.
The quick followup of using Fat Man on Nagasaki was arguably a war crime. With the benefit of hindsight, we should have given them more than three days to consider what it meant to continue war with a country that had nuclear weapons.
In the case of Russia invading Ukraine, Russia is the belligerent. The US did not start the war with Japan but it needed to finish it. Developing and using a nuclear weapon on Hiroshima in the effort to bring the war to a close with less casualties on both sides was probably the best course of action. It would have been much worse if the war had carried on with the status quo.
And speaking of Russia/USSR, dropping the bomb was also a measure of keeping peace by putting them in check. There was a justified concern that the Soviet Union wouldn't have waited long to keep expanding West into the rest of Europe after the war.
RE: A Few From Thunder