Japan surrender was on 15th August 1945. This ended ww2 and brought peace. By mid 1945 the Japanese constrained Japan. The allies knew invading had to come .The Japanese were fully prepared for an invasion.
The allies required full surrender. The Japanese were short on supplies. Japan looked for acceptable terms of surrender. As it was clear Japan will not succumb .
On the 6th of August, America dropped the first atomic bomb on Hiroshima. The Japanese still refused to surrender. The threat from red army with hostilities .
The Americans dropped a bomb again. This time was the city of Nagasaki.
Japan then accepted the terms unconditionally.