In iron-based superconductors (FeSCs), superconductivity is usually induced by doping charge carriers into the antiferromagnetic (AF) parent compounds. With the increase of doping, the long-range AF order is gradually suppressed, while the superconductivity emerges and reaches its optimal T c near the border of the AF order. Though long-range AF order is completely suppressed near optimal doping, strong AF spin fluctuations persist in the optimal and overdoped regime. Numerous experimental evidence in copper-oxide and iron-based high-T c superconductors suggested that S = 1 AF spin fluctuation is the leading candidate "pairing glue" (driven by spin-spin interactions) for mediating high-T c superconductivity. Hence, it is crucial to study magnetic excitation and its doping dependence in FeSCs, which can be used to determine the magnetic interactions and provide key insights into understanding the microscopic mechanism of iron-based high-T c superconductivity. Since the discovery of FeSCs, inelastic neutron scattering (INS) has played a crucial role in measuring the magnetic excitations in FeSCs. As a powerful probe of elementary magnetic excitations in transition-metal compounds, resonant inelastic X-ray scattering (RIXS) has been used to study the magnetic excitations in FeSCs in the past decade. Since RIXS specifies a high-flux, and has the sensitivity for element and valence-state, this technique plays a unique role in studying the magnetic excitations in FeSCs. In this review, we present the research progress concerning the RIXS study of the magnetic excitations in FeSCs, and discuss the advantages and disadvantages of RIXS. We emphasize that it is important to take advantage of the unique aspects of RIXS in studying the elementary excitations in FeSCs.