After the flood, G‑d promised Noah that He would never again bring a flood that would destroy the world. A rainbow is a reminder of this covenant that G‑d made with Noah, his descendants, and all living creatures. Therefore, upon seeing a rainbow in the sky, we recite the following blessing:
בָּרוּךְ אַתָּה ה' אֶלוֹהֵינוּ מֶלֶךְ הָעוֹלָם זוֹכֵר הַבְּרִית וְנֶאֱמָן בִּבְרִיתוֹ וְקַיָם בְּמַאֲמָרוֹ
Baruch ata Ado-nai Elo-heinu melech ha'olam zocher ha'brit v'ne'eman bivrito v'kayam b'ma'amaro.
Blessed are You, Lord our G‑d, King of the universe, who remembers the covenant, and is faithful to His covenant, and keeps His promise.
All the best,
Rochel Chein for Chabad.org