title: Publish to a topic using Google Cloud Pubsub within Compute Engine
body: <p>I am quite new to the GCP platform. I wanted to find out if it were possible to publish to a Google Cloud Pubsub topic from within a Preemptible Compute Engine VM's shutdown script, other than performing REST calls to the PubSub API?</p>
  
  <p>I would like to notify myself each time a Compute Engine Preemptible VM has been scheduled to be preempted.</p>