Exodus.
Chapter 17.
Then all the Israelites left the Desert of Sin, going from place to place as they followed the Lord's commands. They camped at Rephidim, but there wasn't any water for the people to drink. 
Some of them came and complained to Moses, saying, “Give us water to drink!” “Why are you complaining to me?” Moses asked. “Why are you trying to challenge the Lord?” 
But the people were so thirsty for water there that they went on complaining to Moses, saying, “Why did you have to bring us out of Egypt? Are you trying to kill us and our children and livestock by thirst?” 
Moses cried out to the Lord, “What am I going to do with these people? A bit more of this and they're going to stone me!” 
The Lord told Moses, “Go ahead of the people, and take some of the elders of Israel with you. Take with you the walking stick you used to hit the Nile, and just go on ahead. 
Look, I will stand there beside you by the rock at Horeb. When you hit the rock water will pour out for the people to drink.” So Moses did this as the elders of Israel watched. 
He called the place Massah and Meribah because the Israelites argued there, and because they challenged the Lord, saying, “Is the Lord with us, or not?” 
Then some Amalekites came and attacked the Israelites at Rephidim. 
Moses told Joshua, “Choose some men and go out and fight the Amalekites. Tomorrow I'll stand on the top of this hill holding the walking stick of God.” 
Joshua did what Moses told him and fought the Amalekites, while Moses, Aaron, and Hur climbed to the top of the hill. 
As long as Moses held up the walking stick in his hands, the Israelites were the ones winning, but when he lowered them, it was the Amalekites. 
So when Moses' hands became heavy, the others took a stone and put it under him for him to sit on. Aaron and Hur stood on each side of Moses and held his hands up. In this way his hands were kept firmly up until the sun went down. 
As a result Joshua defeated the Amalekite army. 
The Lord told Moses, “Write all this down on a scroll as a reminder and read it out loud to Joshua, because I'm going to completely wipe out the Amalekites so nobody on earth will remember them.” 
Moses built an altar and called it “The Lord is my Banner of Victory.” 
“Hold up the victory banner of the Lord!” Moses declared. “The Lord will go on fighting the Amalekites for all generations!” 
