Abstract. The precise measurements of the proton and helium flux in primary cosmic rays based on on data collected by the Alpha Magnetic Spectrometer during the first 30 months of operation (May 19, 2012 to November 26, 2013 onboard the International Space Station are presented. Knowledge of the rigidity dependence of the proton and helium flux is important in understanding the origin, acceleration, and propagation of cosmic rays in our galaxy. The high statistics of the measurements (300 mio. protons, 50 mio. helium) allow to study the detailed variations with rigidity of the fluxes spectral index. The spectral index of both the proton and the helium flux progressively hardens at rigidities larger than 100 GV. The rigidity dependence of the helium flux spectral index is similar to that of the proton spectral index though the magnitudes are different. Remarkably, the spectral index of the proton to helium flux ratio increases with rigidity up to 45 GV and then becomes constant; the flux ratio above 45 GV is well described by a single power law.