The top quark mass is measured using a template method in the ttlepton+jets channel (lepton is e or ) using ATLAS data recorded in 2012 at the LHC. The data were taken at a proton-proton centre-of-mass energy of =8TeV and correspond to an integrated luminosity of 20.2 fb-1. The ttlepton+jets channel is characterized by the presence of a charged lepton, a neutrino and four jets, two of which originate from bottom quarks(b). Exploiting a three-dimensional template technique, the top quark mass is determined together with a global jet energy scale factor and a relative b-to-light-jet energy scale factor. The mass of the top quark is measured to be mtop=172.08 (syst)GeV. A combination with previous ATLAS mtop measurements gives mtop=172.69 +/- 0.25 0.41 (syst) GeV.