The trend towards serverless computing is gaining more traction. The big cloud vendors are going full steam with the renewed belief that developer should focus on code and string together applications by orchestrating various services. The whole task of provisioning servers to run the code is handled by the platforms themselves. Amazon Web Services was the first to get out of the blocks with their AWS Lambda that has seen wide adoption by developers. Google is hoping to compete head-on with AWS by filling in features in its platform and has announced an Alpha release of a similar offering called Cloud Functions.
Cloud Functions need to get triggered based on some events. These triggers are currently tied with other Google Cloud Platform services like Google Cloud Pub/Sub, Google Cloud Storage. You need to tap into the events that these services may fire. For example your function could subscribe to a topic in Cloud Pub/Sub and when a message is published to the topic, your function is invoked and the message payload is passed to your function. Similarly, you could hook into Google Cloud Storage events across buckets and objects and trigger your function based on that. Some of the use cases mentioned include Cloud Functions that post process an image file once it is uploaded into Google Cloud Storage. A Synchronous mechanism of invocation via HTTP is also supported for Cloud Functions.
You can deploy your Cloud Functions from your local system and/or source repositories like BitBucket and Github. For Cloud Functions from your local file system, you need to first upload them to a Google Cloud Storage Bucket and then use the gcloud command line utilities to deploy it directly. Google has provided a walkthrough that shows you the entire workflow of creating a sample function, using a Cloud Pub/Sub topic as a trigger or via direct HTTP Invocation and then monitoring the execution of your function. Monitoring execution of your functions is well integrated with the Cloud Logging functionality available from the Google Developers Console.