title: How to run custom shell script just before EC2 stop/terminate using systemD services
body: <p>I want to run a shell script just before EC2 terminates or stops, i am using Amazon2 AMI. There is no support for Traditional SysVinit in Amazon2 Image, it relies on Daemon services . So i want to make use of systemD services.
  My shell script will just gracefully shutdown the tomcat and make some DB changes, should not get executed for more than 2m.
  Please suggest.</p>
  
  <p>P.S - I do not want to use LifeCycle Hooks.</p>