"And Moses built an altar and called its name" (Exodus 17:15). Rabbi Eleazar of Modi'in says: Moses said, this miracle that the Holy One, blessed be He, performed, He performed for His own sake. And so you find that whenever Israel is in a miracle, the miracle is, as it were, before Him, as it is said, "The LORD is my banner." When there is trouble for Israel, it is as if there is trouble before Him, as it is said (Isaiah 63:9), "In all their affliction He was afflicted." When there is joy for Israel, there is joy before Him, as it is said, "For I have rejoiced in Your salvation" (1 Samuel 2:1). One verse says (Deuteronomy 25:19), "You shall blot out the remembrance of Amalek," and another verse says, "I will utterly blot out the remembrance of Amalek" (Exodus 17:14). Before he stretched out his hand against the Throne, "You shall blot out the remembrance of Amalek"; but once he stretched out his hand against the Throne, "I will utterly blot out the remembrance of Amalek." And does flesh and blood have the power to stretch out its hand against the Throne of the Holy One, blessed be He? Rather, because he is destined to destroy Jerusalem, as it is written (Jeremiah 3:17), "At that time they shall call Jerusalem the Throne of the LORD." Therefore, "I will utterly blot out the remembrance of Amalek."
The LORD Is My Banner and Shares Israel's Trouble
Yalkut Shimoni on Torah 267:1
וַיִּבֶן מֹשֶׁה מִזְבֵּחַ וַיִּקְרָא שְׁמוֹ וְגוֹ'. רַבִּי אֶלְעָזָר הַמּוֹדָעִי אוֹמֵר, אָמַר מֹשֶׁה, הַנֵּס הַזֶּה שֶׁעָשָׂה הַמָּקוֹם בְּגִינוֹ עֲשָׂאוֹ, וְכֵן אַתָּה מוֹצֵא שֶׁכָּל זְמַן שֶׁיִּשְׂרָאֵל בְּנֵס כִּבְיָכוֹל הַנֵּס לְפָנָיו, שֶׁנֶּאֱמַר ה' נִסִּי, צָרָה לְיִשְׂרָאֵל, כְּאִילּוּ צָרָה לְפָנָיו, שֶׁנֶּאֱמַר (ישעיה סג, ט) "בְּכָל צָרָתָם לוֹ צָר", שִׂמְחָה לְיִשְׂרָאֵל שִׂמְחָה לְפָנָיו, שֶׁנֶּאֱמַר "כִּי שָׂמַחְתִּי בִּישׁוּעָתֶךָ". כָּתוּב אֶחָד אוֹמֵר, (דברים כה, יט) "תִּמְחֶה אֶת זֵכֶר עֲמָלֵק", וְכָתוּב אֶחָד אוֹמֵר, מָחֹה אֶמְחֶה אֶת זֵכֶר עֲמָלֵק, עַד שֶׁלֹּא פָּשַׁט יָדוֹ בַּכִּסֵא, "תִּמְחֶה אֶת זֵכֶר עֲמָלֵק", וּמִשֶּׁפָּשַׁט יָדוֹ בַּכִּסֵא, כִּי מָחֹה אֶמְחֶה אֶת זֵכֶר עֲמָלֵק. וְכִי בָּשָׂר וָדָם יֵשׁ בּוֹ כֹּחַ לִפְשֹׁט יָדוֹ בְּכִסְּאוֹ שֶׁל הַקָּדוֹשׁ בָּרוּךְ הוּא, אֶלָּא עַל יְדֵי שֶׁהוּא עָתִיד לְהַחֲרִיב אֶת יְרוּשָׁלַיִם, דִּכְתִיב (ירמיה ג, יז) "בָּעֵת הַהִיא יִקְרְאוּ לִירוּשָׁלַם כִּסֵּא ה'", לְפִיכָךְ מָחֹה אֶמְחֶה אֶת זֵכֶר עֲמָלֵק.