To what was Israel comparable? To one who was riding upon his father's shoulders, and he would see a desirable thing and say to his father to buy it for him, and he bought it for him. So too a second time, and a third time. As they were walking along, he saw a certain man. He said to him, "Have you seen my father?" [His father said to him, "You are riding upon my shoulders, and everything that you ask I do for you, and you say to him, 'Have you seen my father?'"] What did he do? He threw him off his shoulders, and the dog came and bit him. So were Israel: when Israel went out from Egypt, immediately the clouds of glory surrounded them. They asked, and the Holy One brought down manna for them; they asked for quail, and He brought it to them, as it is said, "And He brought them what they craved" (Psalms 78:29). He was giving them all their needs. They began to reflect and say, "Is the LORD present among us or not?" (Exodus 17:7). The Holy One said to them, "By your lives, I am informing you: behold, the dog is coming and biting you." And who is this? This is Amalek, as it is said, "Then Amalek came" (Exodus 17:8).
The Child on His Father's Shoulders and the Biting Dog of Amalek
Midrash Tanchuma Buber, Yitro 4:1
למה היו ישראל דומין, לאחד שהיה רוכב על כתיפיו של אביו, והיה רואה דבר של חפץ, ואמר לאביו ליקח לו, ולקח לו, כן פעם שני, ופעם שלישי, עד שהן מהלכין ראה אדם אחד אמר לו ראית את אבי [אמר לו אתה רוכב על כתפי וכל מה שאתה מבקש אני עושה לך ואתה אומר לו ראית את אבי] מה עשה השליכו מעל כתיפו, ובא הכלב ונשכו, כך היו ישראל, כשיצאו ישראל ממצרים, מיד הקיפו אותם ענני כבוד, בקשו מן הוריד להן הקב"ה, בקשו שליו הביא להם, שנאמר ותאותם יביא להם (תהלים עח כט), היה נותן להם כל צרכם, התחילו מהרהרים ואומרים היש ה' בקרבנו אם אין (שמות יז ז), אמר להם הקב"ה חייכם אני מודיע אתכם הרי הכלב בא ונושך אתכם, ומי הוא זה זה עמלק, שנאמר ויבא עמלק.