Michael Wheatley admitted to one count of robbery, possession of a firearm or imitation firearm and being unlawfully at large during a hearing at Guildford Crown Court.
Following the incident Wheatley was arrested on the day of the offence by Metropolitan and Kent Police officers in Tower Hamlets and taken into police custody.
Detective Chief Inspector Chris Raymer, of Surrey Police, said: “Wheatley is a dangerous individual and I welcome the lengthy sentence imposed at today’s hearing which reflects the seriousness of his crimes.
“This was clearly an extremely distressing incident for the members of staff in the building society who were threatened by Wheatley and I hope the sentence helps them to move forward.
“Officers were at the scene within minutes of the emergency call and we worked closely with Metropolitan and Kent Police colleagues, resulting in Wheatley being arrested within hours of the offence.â€