The 21-year-old released the track under his DJ stage name Ansolo, reported Aceshowbiz.
"The Fault in Our Stars" actor shared the news of the release on Twitter.
"Here we go! 'To Life' is out now! so hype!" he wrote.
The track sighted as perfect for music festivals and EDM nights was created with band Too Many Zooz.
Elgort, who is currently signed to Island Records said making music is more than writing or performing. It is a lot about engineering and producing.