Hadithcore
Hadith #2106390

Narrated Abu Hurairah (RA):

Allah's Messenger (ﷺ) said: Sulaiman (AS) (Solomon - Peace be upon him) went out to pray for rain, and he saw an ant lying on its back, raising its legs to the sky saying: "O Allah, we are creatures among your creatures, we cannot live without your water." He said (to his companions), "Go back, for you have been given water through the supplication of others." [Reported by Ahmad and al-Hakim graded it Sahih (authentic)].

وَعَنْ أَبِي هُرَيْرَةَ ‏- رضى الله عنه ‏- أَنَّ رَسُولَ اَللَّهِ ‏- صلى الله عليه وسلم ‏-قَالَ: { خَرَجَ سُلَيْمَانُ عَلَيْهِ اَلسَّلَامُ يَسْتَسْقِي, فَرَأَى نَمْلَةً مُسْتَلْقِيَةً عَلَى ظَهْرِهَا رَافِعَةً قَوَائِمَهَا إِلَى اَلسَّمَاءِ تَقُولُ: اَللَّهُمَّ إِنَّا خَلْقٌ مِنْ خَلْقِكَ, لَيْسَ بِنَا غِنًى عَنْ سُقْيَاكَ, فَقَالَ: ارْجِعُوا لَقَدْ سُقِيتُمْ بِدَعْوَةِ غَيْرِكُمْ } رَوَاهُ أَحْمَدُ وَصَحَّحَهُ اَلْحَاكِمُ [1]‏ .‏

References2 variants
Sunnah.com reference
Book 2, Hadith 453
Arabic/English book reference
Book 2, Hadith 520