A Commentary, Critical, Practical, and Explanatory on the Old and New Testaments, by Robert Jamieson, A.R. Fausset and David Brown  at sacred-texts.com
exo 17:1THE PEOPLE MURMUR FOR WATER. (Exo 17:1-7)
the children of Israel journeyed from the wilderness of Sin--In the succinct annals of this book, those places only are selected for particular notice by the inspired historian, which were scenes memorable for their happy or painful interest in the history of the Israelites. A more detailed itinerary is given in the later books of Moses, and we find that here two stations are omitted (Num. 33:1-56).
according to the commandment of the Lord, &c.--not given in oracular response, nor a vision of the night, but indicated by the movement of the cloudy pillar. The same phraseology occurs elsewhere (Num 9:18-19).
pitched in Rephidim--now believed, on good grounds, to be Wady Feiran, which is exactly a day's march from Mount Sinai, and at the entrance of the Horeb district. It is a long circuitous defile about forty feet in breadth, with perpendicular granite rocks on both sides. The wilderness of Sin through which they approached to this valley is very barren, has an extremely dry and thirsty aspect, little or no water, scarcely even a dwarfish shrub to be seen, and the only shelter to the panting pilgrims is under the shadow of the great overhanging cliffs.
exo 17:2the people did chide with Moses, and said, Give us water that we may drink, &c.--The want of water was a privation, the severity of which we cannot estimate, and it was a great trial to the Israelites, but their conduct on this new occasion was outrageous; it amounted even to "a tempting of the Lord." It was an opposition to His minister, a distrust of His care, an indifference to His kindness, an unbelief in His providence, a trying of His patience and fatherly forbearance.
exo 17:4Moses cried unto the Lord, saying, What shall I do unto this people?--His language, instead of betraying any signs of resentment or vindictive imprecation on a people who had given him a cruel and unmerited treatment, was the expression of an anxious wish to know what was the best to be done in the circumstances (compare Mat 5:44; Rom 12:21).
exo 17:5the Lord said unto Moses, &c.--not to smite the rebels, but the rock; not to bring a stream of blood from the breast of the offenders, but a stream of water from the granite cliffs. The cloud rested on a particular rock, just as the star rested on the house where the infant Saviour was lodged [Mat 2:9]. And from the rod-smitten rock there forthwith gushed a current of pure and refreshing water. It was perhaps the greatest miracle performed by Moses, and in many respects bore a resemblance to the greatest of Christ's: being done without ostentation and in the presence of a few chosen witnesses (Co1 10:4).
exo 17:7called the name of the place--Massah ("temptation"); Meribah ("chiding," "strife"): the same word which is rendered "provocation" (Heb 3:8).
exo 17:8ATTACK OF AMALEK. (Exo 17:8-16)
Then came Amalek--Some time probably elapsed before they were exposed to this new evil; and the presumption of there being such an interval affords the only ground on which we can satisfactorily account for the altered, the better, and former spirit that animated the people in this sudden contest. The miracles of the manna and the water from the rock had produced a deep impression and permanent conviction that God was indeed among them; and with feelings elevated by the conscious experience of the Divine Presence and aid, they remained calm, resolute, and courageous under the attack of their unexpected foe.
fought with Israel--The language implies that no occasion had been furnished for this attack; but, as descendants of Esau, the Amalekites entertained a deep-seated grudge against them, especially as the rapid prosperity and marvellous experience of Israel showed that the blessing contained in the birthright was taking effect. It seems to have been a mean, dastardly, insidious surprise on the rear (Num 24:20; Deu 25:17), and an impious defiance of God.
exo 17:9Moses said unto Joshua--or, "Jesus" (Act 7:45; Heb 4:8). This is the earliest notice of a young warrior destined to act a prominent part in the history of Israel. He went with a number of picked men. There is not here a wide open plain on which the battle took place, as according to the rules of modern warfare. The Amalekites were a nomadic tribe, making an irregular attack on a multitude probably not better trained than themselves, and for such a conflict the low hills and open country around this wady would afford ample space [ROBINSON].
exo 17:10Moses . . . went up . . . the hill . . . held up his hand--with the wonder-working rod; Moses acted as the standard bearer of Israel, and also their intercessor, praying for success and victory to crown their arms--the earnestness of his feelings being conspicuously evinced amid the feebleness of nature.
exo 17:13Joshua discomfited Amalek--Victory at length decided in favor of Israel, and the glory of the victory, by an act of national piety, was ascribed to God (compare Jo1 5:4).
exo 17:14Write this for a memorial--If the bloody character of this statute seems to be at variance with the mild and merciful character of God, the reasons are to be sought in the deep and implacable vengeance they meditated against Israel (Psa 83:4).