After the eggs boiled I left them in the hot water for 2 hours, drained them then put them in fridge overnight. Are they still ok to eat?
The strictest rule of food safety says ' In temperature danger zone (40-140 °F or 4-60 °C) for a total of six hours, with only two hours allotted to get through the 135-71 °F range (57-22 °C).
So, let's suppose the eggs went from boiling to room temperature in two hours. We cannot say that the cooling time was even throughout the temperature range, as cooling is proportional to temperature difference, so it cooled faster when it was hotter than the surroundings. Therefore, the eggs likely cooled half the way in the first half hour, then the other half in the next 1 ½ hours (rough approximation.)
Your eggs were brought off the boil, presumably at about 200°F / 93°C and sat for two hours. We do not have cooling data, but it cooled some amount , then draining and in the fridge means cooled to 40°F well within 6 hours. The guideline would state that it was above 71°F for more than two hours, but we can interpret this:
At boiling temperature, there was little or no chance for any bacteria. You then started to cool them, but any previous bacteria are dead. A small amount of airborne could be introduced, but again, a small amount. The eggs were then brought to the safe storage temperature.
Throughout all of this and the guidelines, the eggs spent a little too much time above 71°F, but not much.
Eat them. Enjoy.