The whole Israelite community broke camp and set out from the Sin desert to continue their journey, as the LORD commanded. They set up their camp at Rephidim, but there was no water for the people to drink.
References for Exodus 17:1
The people argued with Moses and said, "Give us water to drink." Moses said to them, "Why are you arguing with me? Why are you testing the LORD?"
But the people were very thirsty for water there, and they complained to Moses, "Why did you bring us out of Egypt to kill us, our children, and our livestock with thirst?"
So Moses cried out to the LORD, "What should I do with this people? They are getting ready to stone me."
The LORD said to Moses, "Go on ahead of the people, and take some of Israel's elders with you. Take in your hand the shepherd's rod that you used to strike the Nile River, and go.
I'll be standing there in front of you on the rock at Horeb. Hit the rock. Water will come out of it, and the people will be able to drink." Moses did so while Israel's elders watched.
He called the place Massah and Meribah, because the Israelites argued with and tested the LORD, asking, "Is the LORD really with us or not?"
References for Exodus 17:7
Amalek came and fought with Israel at Rephidim.
References for Exodus 17:8
Moses said to Joshua, "Choose some men for us and go fight with Amalek. Tomorrow I'll stand on top of the hill with the shepherd's rod of God in my hand."
So Joshua did as Moses told him. He fought with Amalek while Moses, Aaron, and Hur went up to the top of the hill.
Whenever Moses held up his hand, Israel would start winning the battle. Whenever Moses lowered his hand, Amalek would start winning.
But Moses' hands grew tired. So they took a stone and put it under Moses so he could sit down on it. Aaron and Hur held up his hands, one on each side of him so that his hands remained steady until sunset.
So Joshua defeated Amalek and his army with the sword.
Then the LORD said to Moses, "Write this as a reminder on a scroll and read it to Joshua: I will completely wipe out the memory of Amalek under the sky."
Moses built an altar there and called it, "The LORD is my banner."
He said, "The power of the LORD's banner! The LORD is at war with Amalek in every generation."
References for Exodus 17:16