The two evil midos the Torah tells us to remember are, Remember what Hashem your G-d did to Miriam (Devorim 24:9), and, Remember what Amalek did to you (Devorim 25:17).The first verse warns us to keep far from lashon hora, and the second verse tells us to remember the evil of Amalek.
Rabeinu Yonah goes on to say that the Torah tells us to ‘remember’ Miriam’s lashon hora and the evil of Amalek, because these two things also involve principles of faith. Regarding lashon hora, Chazal (Yalkut Tehillim 656) say: “Whoever speaks lashon hora is considered as if he denied a principle of faith, etc.” And regarding Amalek, the medrash (Pirkei d’Rabbi Eliezer 44) tells us that the main reason we remember this nation is in order to constantly remember Hashem’s presence.
“This can be compared to a king who had a beautiful vineyard,” the medrash says. “He fenced it and placed a dog there to guard it. The king’s son came to break the fence and the dog bit him. Afterwards, whenever the king wanted to warn his son about the vineyard he said to him, ‘Remember the dog’s bite.’ The same applies to Yisroel. When they were in Refidim they said, Is Hashem in our midst or not (Shemos 17:7). Immediately, And Amalek came (ibid 17:8). Therefore, He commanded them, Remember what Amalek did to you (Devorim 25:17), meaning, and guard yourself from this sin.”
In other words, the main purpose of remembering Amalek is not only to eradicate Amalek in the future, but also, and no less importantly, to remind us of the sin of forgetting Hashem that caused Amalek to attack us in the first place.
If we examine the story of Amalek closer, we see that Amalek’s attack was an exact replica of the sin that caused it. Commenting on the verse, That he made you cold (karcha) on the road (Devorim 25:18), Chazal explain that the Jews were initially like a hot bath; all the nations were afraid to “jump into” the bath and attack them after Hashem plagued the Egyptians and drowned them at the Red Sea. Amalek then ‘cooled’ the Jewish people, making it possible for others to follow their example. This was measure for measure. Because the Jews had questioned whether Hashem was in their midst, Amalek weakened the nations’ awareness that Hashem constantly protects His people and made the Jews vulnerable to their attack.
Also, because Klal Yisroel questioned Hashem’s protective powers, measure for measure they were specifically attacked by the Amalek nation thatdid not fear Hashem and was unfazed by the miracles of Egypt and the Red Sea.
To rectify the Jews’ shortcoming that led to the Amalek attack, Hashem told Moshe to keep his hands raised during the war against them. Chazal (Rosh Hashanah 29) tell us that Moshe’s hands themselves had no power to effect the war. Rather, “all the time Yisroel gazed upwards and subjugated their hearts to their Father in heaven, they overcame [Amalek], and if not, they fell.” Just as Amalek came because of the Jews’ lack of awareness of Hashem, so to conquer Amalek they needed to constantly subjugate their hearts to their Father in heaven.
The same applies to us as well. To remain secure from Amalek and other enemies, we must cultivate an awareness of Hashem’s constant providing our needs and protecting us from our enemies. This awareness will then lead to yiras Shomayim that provides the foundation for fulfilling all the Torah’s commands as the verse says, And now Yisroel, what does Hashem your G-d demand from you except to fear Hashem your G-d, to walk in all His ways, and to serve Hashem your L-rd with all your heart and with all your soul (Devorim 10:12).