A number of microlensing dark-matter surveys have produced tens of millions of light curves of individual background stars. These data provide an unprecedented opportunity for systematic studies of whole classes of variable stars and their host galaxies. We aim to use the EROS-2 survey of the Magellanic Clouds to detect and study the population of beat Cepheids (BCs) in both Clouds. BCs pulsating simultaneously in the first overtone and fundamental modes (FO/F) or in the second and first overtone modes (SO/FO) are of particular interest. Using special software designed to search for periodic variables, we have scanned the EROS-2 data base for variables in the typical period range of Cepheids. Metallicities of FO/F objects were then calculated from linear nonadiabatic convective stellar models. We identify 74 FO/F BCs in the LMC and 41 in the SMC, and 173 and 129 SO/FO pulsators in the LMC and SMC, respectively; 185 of these stars are new discoveries. For nearly all the FO/F objects we determine minimum, mean, and maximum values of the metallicity. The EROS data have expanded the samples of known BCs in the LMC by 31%, in the SMC by 110%. The FO/F objects provide independent measures of metallicities in these galaxies. The mean value of metallicity is 0.0045 in the LMC and 0.0018 in the SMC.