The entire Israelite community left the Wilderness of Sin, moving from one place to the next according to the LORD's command. They camped at Rephidim, but there was no water for the people to drink.
So the people complained to Moses: "Give us water to drink." "Why are you complaining to me?" Moses replied to them. "Why are you testing the LORD?"
But the people thirsted there for water, and grumbled against Moses. They said, "Why did you ever bring us out of Egypt to kill us and our children and our livestock with thirst?"
Then Moses cried out to the LORD, "What should I do with these people? In a little while they will stone me!"
The LORD answered Moses, "Go on ahead of the people and take some of the elders of Israel with you. Take the rod you struck the Nile with in your hand and go.
I am going to stand there in front of you on the rock at Horeb; when you hit the rock, water will come out of it and the people will drink." Moses did this in the sight of the elders of Israel.
He named the place Massah and Meribah because the Israelites complained, and because they tested the LORD, saying, "Is the LORD among us or not?"
At Rephidim, Amalek came and fought against Israel.
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.
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.
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."
And Moses built an altar and named it, "The LORD Is My Banner."
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."