High-temperature iron-based superconductivity develops in a structure with unusual lattice-orbital geometry, based on a planar layer of Fe atoms with 3d orbitals and tetrahedrally coordinated by anions. Here we elucidate the electronic role of anions in the iron-based superconductors utilizing state-of-the-art scanning tunneling microscopy. By measuring the local electronic structure, we find that As anion in Ba0.4K0.6Fe2As2 has a striking impact on the electron pairing. The superconducting electronic feature can be switched off/on by removing/restoring As atoms on Fe layer at the atomic scale. Our analysis shows that this remarkable atomic switch effect is related to the geometrical cooperation between anion mediated hopping and unconventional pairing interaction. Our results uncover that the local Fe-anion coupling is fundamental for the pairing interaction of iron-based superconductivity, and promise the potential of bottom-up engineering of electron pairing.