Cosmology plays a central role in understanding the nature of dark matter (DM), with the power to test models which are hard to access by other means. The ultra-light axion is a compelling particle candidate that is motivated, e.g., by the string theory "axiverse" and as a possible solution to the so-called "small-scale crisis" of the cold dark matter model, if its mass is ~ 10^-22 eV. I will present new, robust bounds on the axion mass that improve by over an order of magnitude relative to previous studies. This now significantly excludes the canonical mass scale of 10^-22 eV. The bounds exploit cosmological data from the cosmic microwave background, galaxy clustering, galaxy weak lensing and, in particular, spectroscopic observations of the intergalactic medium: the Lyman-alpha forest. In the search for light, sub-GeV dark matter, cosmology is highly complementary to direct detection experiments, which have limited sensitivity to light DM by nuclear recoil. I will present the strongest cosmological bounds on the dark matter -- proton cross section for DM masses from 10 keV to 100 GeV. This exploits a dark matter "emulator", which is a machine learning method to exploit the full power of cosmological simulations in setting limits.