Shemot (Exodus): Beshalach > Ch 17
Children of Israel camp at Rephidim and complain that they have no water to drink
Children of Israel traveled from the desert of Sin and encamped at Rephidim. They complain that there is no water to drink and they would rather be in Egypt. Moses asks G-d for help, fearing that the people might kill him.
G-d tells Moses to strike a rock with his staff and water comes out of the rock
G-d told Moses:
Pass before the people and take with you [some] of the elders of Israel, and take into your hand your staff, with which you struck the Nile, and go. Behold, I shall stand there before you on the rock in Horeb, and you shall strike the rock, and water will come out of it, and the people will drink
Moses did so and he named the place Massah [testing] and Meribah [quarreling] because of the quarrel of the children of Israel and because of their testing the Lord, saying, Is the Lord in our midst or not?
Amalek attacks Israel. We will fight Amalek through generations, until G-d will obliterate them.
Amalek attacked Israel. Joshua led the fight against Amalek. During the battle, Moses stood on top of the hill and held up his staff. When Moses would raise his hand, Israel would prevail, and when he would lay down his hand, Amalek would prevail. Aaron and Hur helped Moses by supporting his hands. Joshua weakened Amalek and his people with the edge of the sword.
G-d told Moses:
Inscribe this [as] a memorial in the book, and recite it into Joshua's ears, that I will surely obliterate the remembrance of Amalek from beneath the heavens
Moses built an altar, and he named it The Lord is my miracle. And he said, For there is a hand on the throne of the Eternal, [that there shall be] a war for the Lord against Amalek from generation to generation.
He was the son of Miriam, and Caleb, her husband. — [from Sotah11b]
when Moses would raise his hand
Did Moses’ hands then make them victorious in battle, etc.? [Rather this is to tell you that when the Israelites looked up and subjugated their hearts to their Father in heaven, they would prevail, and if not, they would fall,] as is found in Rosh Hashanah (29a).
and recite it into Joshua’s ears
[Joshua] was destined to bring Israel into the land [of Israel and] to pay him [Amalek] his recompense. Here it was hinted to Moses that Joshua would bring Israel into the land. — [from Tanchuma 28, Mechilta]
“The Lord is my miracle”
Heb. ה נִסִּי. The Holy One, blessed be He, wrought a great miracle for us here. Not that the altar is called “The Lord,” but whoever mentions the name of the altar remembers the miracle that the Omnipresent performed: The Lord is our miracle. — [from Mechilta]