Moses commanded Joshua, "Call the Israelites to arms, and fight the army of Amalek. Tomorrow, I will stand at the top of the hill with the staff of God in my hand."
So Joshua did what Moses had commanded. He led his men out to fight the army of Amalek. Meanwhile Moses, Aaron, and Hur went to the top of a nearby hill.
As long as Moses held up the staff with his hands, the Israelites had the advantage. But whenever he lowered his hands, the Amalekites gained the upper hand.
Moses' arms finally became too tired to hold up the staff any longer. So Aaron and Hur found a stone for him to sit on. Then they stood on each side, holding up his hands until sunset.
As a result, Joshua and his troops were able to crush the army of Amalek.
Then the LORD instructed Moses, "Write this down as a permanent record, and announce it to Joshua: I will blot out every trace of Amalek from under heaven."
Moses built an altar there and called it "The LORD Is My Banner."
References for Exodus 17:15
He said, "They have dared to raise their fist against the LORD's throne, so now the LORD will be at war with Amalek generation after generation."
References for Exodus 17:16