Midrash Rabbah - Exodus XXVI:1

1. THEN CAME AMALEK (XVII, 8). It is written, I was not at ease, neither was I quiet, neither had I rest; but trouble came (Job III, 26). ’ I was not at ease ’-on account of Babylon; ’ neither was I quiet ‘-on account of Persia; ’neither had I rest’-on account of Greece; ’but trouble came’-with Edom. Another explanation: I was not at ease’-on account of the first decree which Pharaoh decreed against me,1 as it says, And they made their lives bitter (Ex. I, 14). God raised up a deliverer for them-Miriam, whose name intimates the bitterness (mirur) of slavery. ' Neither was I quiet’-on account of the second decree, If it be a son, then ye shall kill him (ib. 16); God then raised up a redeemer-Aaron, whose name alludes to birth.2 ’Neither had I rest’-on account of the third decree which [Pharaoh] decreed: Every son that is born ye shall cast into the river (ib. 22); but God raised up a redeemer-Moses, whose name indicates his association with water, for it says, Because I drew him out of the water (ib. II, 10).3 ’But trouble came’-this refers to Amalek.4

Midrash Rabbah - Exodus XXVI:2

2. THEN CAME AMALEK. What precedes? And all the congregation of the children of Israel journeyed... and there was no water for the people to drink (ib. XVII, 1); that is, there was none for the people, but there was water for the flocks and herds.5 Whereupon they commenced to quarrel with Moses, saying, Wherefore hast thou brought us up out of Egypt (ib. 3). It was this that prompted R. Judah to say: Woe unto the windows, if the house falls!6Hence they said, To kill us and our children and our cattle with thirst (ib.)-some say a man's cattle is his life, for if a man goes on a journey without his beasts of burden, he suffers.1 Moses at once began to pray, as it says, And Moses cried unto the Lord, saying-lemor (ib. 4). What does ‘ lemor ‘ mean?2 ‘Lord of the Universe! Let me know whether they intend to slay me or not.’3 The reply was: ‘Why should you worry? Pass on before the people’ (ib. 5). What is meant by ’pass on’4?’-Forgive their words.
R. Meir said: What does ’pass on’ mean? God said: ' Resemble Me; just as I repay good for evil so do thou also repay good for evil,’ as it says, Who is a God like unto Thee, that pardoneth the iniquity, and passeth by the transgression (Micah VII, 18). R. Judah said: Overlook their sins. R. Nehemiah said: ’ Pass on before the people’- that is, let him who is presumptuous come and complain before thee. And take with thee of the elders of Israel (Ex. Ioc. cit.), that they should act as witnesses lest the people afterwards say to thee: ' There were fountains there.’ And thy rod, wherewith thou smotest the river (ib.). Moses then said: ‘Lord of the Universe. This is the rod of punishment, for it caused the waters in Egypt to stink,5 and it brought the ten plagues on the Egyptians.’ But God replied: ‘My methods are not those of mortals; man cuts with a knife and heals with a bandage, but I heal with the thing with which I smite.’6 ‘And thy rod, wherewith thou smotest the river, take in thy hand’ (ib.), so that all may know that it is an instrument of blessing. And thou shalt smite the rock (ib. 6). What is the meaning of these words?-God said: ' They can have their choice of rocks; from whichever they want water, give it to them. ‘-As soon as the water gushed forth, it provided all the tents of Israel with water.

What is written in this connection?-And the name of the place was called Massah, and Meribah-trial and strife (ib. 7). What strife was there?- [This was the subject of a discussion between] R. Judah, R. Nehemiah, and the Sages. R. Judah said: This is what they argued: If He be the Lord of all works as He is Lord over us,1 we will serve Him; but if not, then we will rebel against Him. R. Nehemiah said: If He will supply us with sufficient food like a king who dwells in a city without its inhabitants having constant recourse to him, then we will serve Him; but if not, we will rebel against Him.2 Our Sages said: If we entertain thoughts in our hearts and He knows what we are thinking, then we will serve Him, but if not, then we will rebel against Him.3 God, thereupon, said to them: ' If your intention is to test Me, let the wicked one come and test you; straightway we read: THEN CAME AMALEK. What is written there?-Is the Lord among us, or not? THEN CAME AMALEK. What is the connection between the two? It can be compared to a small child seated upon his father's shoulders, who, beholding a friend of his father, called out: ‘Have you seen my father?’ The father then said: ‘You are riding upon my shoulders, and yet you inquire of my whereabouts? I will cast you down, so that the enemy may come and master you.’ This is what God said to Israel: ' I have borne you on clouds of glory’ and yet you say, "Is the Lord among us, or not?" Let the enemy come, therefore, and prevail over you’; hence, THEN CAME AMALEK.6

Midrash Rabbah - Exodus XXVI:3

3. AND MOSES SAID UNTO JOSHUA: CHOOSE US OUT MEN (XVII, 9). Why to Joshua? The primary explanation is because he wanted to train him for battle, for he [Joshua] would bring Israel into the Land. Another explanation of, why to Joshua: He said to him: ‘Since Israel came down to Egypt because of thy ancestor, thou must fight with him who attacks them on their departure.1 Another explanation of, why to Joshua: [Moses] said to him: ‘Thy ancestor said, For I fear God (Gen. XLII, 18), and of this one2 it says, And he feared not God (Deut. XXV, 18); let the descendant of him who said, "For I fear God" come and punish him of whom it says, "And he feared not God.’ CHOOSE US OUT MEN. What is the meaning of MEN.? Men of wisdom and who fear sin.3 AND GO OUT, FIGHT WITH AMALEK. You can deduce from here that they were underneath the clouds of glory, for the words GO OUT are only applied to those who dwell within. WITH THE ROD OF GOD IN MY HAND (ib.). He said to [Joshua]: ‘This rod is in my hand, for God said, Let it always be in thy hand.’ Another explanation of WITH THE ROD OF GOD IN MY HAND. When Aaron did wonders with it, it was called after him,
as it says, The rod of Aaron (ib. VII, 12). When I perform wonders with it, it is called after me; and when God performs miracles, it is called after Him-hence here WITH THE ROD OF GOD.