Precision measurements by the Alpha Magnetic Spectrometer (AMS) on the International Space Station of the deuteron (D) flux are presented. The measurements are based on 21×10^{6} D nuclei in the rigidity range from 1.9 to 21 GV collected from May 2011 to April 2021. We observe that over the entire rigidity range the D flux exhibits nearly identical time variations with the p, ^{3}He, and ^{4}He fluxes. Above 4.5 GV, the D/^{4}He flux ratio is time independent and its rigidity dependence is well described by a single power law ∝R^{Δ} with Δ_{D/^{4}He}=-0.108±0.005. This is in contrast with the ^{3}He/^{4}He flux ratio for which we find Δ_{^{3}He/^{4}He}=-0.289±0.003. Above ∼13 GV we find a nearly identical rigidity dependence of the D and p fluxes with a D/p flux ratio of 0.027±0.001. These unexpected observations indicate that cosmic deuterons have a sizable primarylike component. With a method independent of cosmic ray propagation, we obtain the primary component of the D flux equal to 9.4±0.5% of the ^{4}He flux and the secondary component of the D flux equal to 58±5% of the ^{3}He flux.