The impact of three-dimensional (3D) tokamak geometry from external magnetic perturbations on edge instabilities has been examined in high confinement mode plasmas with edge localised modes (ELMs) in ASDEX Upgrade. The 3D geometry has been probed using rigidly rotating MP fields. The measured distortions of the plasma boundary are compared to single-fluid ideal magnetohydrodynamic (MHD) equilibria using VMEC and MARS-F applying ideal and resistive MHD, whereas VMEC uses only ideal MHD. Both codes accurately reproduce the measured radial displacements of the edge density and temperature profiles in amplitude, toroidal phase and their dependence on the applied poloidal mode spectrum.The induced 3D geometry distorts the local magnetic shear, which locally reduces the stabilising effect from field-line bending at certain most unstable field lines. Around these field lines, we observe additional stable ideal MHD modes with clear ballooning structure in-between ELMs. After their immediate appearance, they saturate and then grow on timescales of the pedestal pressure recovery. The subsequent ELMs show strongly localised magnetic Plasma Physics and Controlled Fusion