Three people were injured in the June 12 attack at Pudong International Airport by Zhou Xingbai, who the court said had been struggling with personal and romantic problems.
Zhou, who was 29 at the time of the attack, fashioned the makeshift bombs using fireworks and beer bottles.
The court statement said Zhou rolled three of them into a crowd before attempting suicide by slashing at his neck with a knife.
Two of the devices exploded, injuring several travellers and causing flight cancellations and delays.
More From This Section
Originally from the southwestern province of Guizhou, Zhou had a high-school education and worked at various jobs before relocating in 2014 to Kunshan, a city near Shanghai, Chinese police have said.
Zhou's punishment was severe because the incident occurred in a large public space, the court statement said.
In 2013, a wheelchair-bound man detonated a homemade bomb at Beijing international airport and was sentenced to six years in jail.