Context. The red MSX source (RMS) survey has identified a large sample of candidate massive young stellar objects (MYSOs) and ultra compact (UC) HII regions from a sample of ~2000 MSX and 2MASS colour selected sources. Aims. To search for H2O masers towards a large sample of young high mass stars and to investigate the statistical correlation of H2O masers with the earliest stages of massive star formation. Methods. We have used the Mopra Radio telescope to make position-switched observations towards ~500 UCHII regions and MYSOs candidates identified from the RMS survey and located between 190°?<?l?<?30°. These observations have a 4$\sigma$ sensitivity of ~1 Jy and a velocity resolution of ~0.4 km s-1. Results. We have detected 161 H2O masers, approximately 75% of which were previously unknown. Comparing the maser velocities with the velocities of the RMS sources, determined from 13CO observations, we have identified 135 RMS-H2O maser associations, which corresponds to a detection rate of ~27%. Taking into account the differences in sensitivity and source selection we find our detection rate is in general agreement with previously reported surveys. Conclusions. We find similar detection rates for UCHII regions and MYSOs candidates, suggesting that the conditions needed for maser activity are equally likely in these two stages of the star formation process. Looking at the detection rate as a function of distance from the Galactic centre we find it significantly enhanced within the solar circle, peaking at ~37% between 6–7 kpc, which is consistent with previous surveys of UC HII regions, possibly indicating the presence of a high proportion of more luminous YSOs and HII regions.