At Rephidim, Amalek came and fought against Israel.
References for Exodus 17:8
Moses said to Joshua, "Select some men for us, and go fight against Amalek. Tomorrow I will stand on the hilltop with God's staff in my hand."
Joshua did as Moses had told him, and fought against Amalek, while Moses, Aaron, and Hur went up to the top of the hill.
While Moses held up his hand, Israel prevailed, but whenever he put his hand down, Amalek prevailed.
References for Exodus 17:11
When Moses' hands grew heavy, they took a stone and put [it] under him, and he sat down on it. Then Aaron and Hur supported his hands, one on one side and one on the other so that his hands remained steady until the sun went down.
So Joshua defeated Amalek and his army with the sword.
References for Exodus 17:13
The Lord then said to Moses, "Write this down on a scroll as a reminder and recite it to Joshua: I will completely blot out the memory of Amalek under heaven."
References for Exodus 17:14
And Moses built an altar and named it, "The Lord Is My Banner."
References for Exodus 17:15
He said, "Indeed, [my] hand is [lifted up] toward the Lord's throne. The Lord will be at war with Amalek from generation to generation."
References for Exodus 17:16