Google Announces Cloud Functions, Takes on AWS Lambda

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 are small, single-purpose functions that get invoked based on a trigger. You don't have to worry about provisioning, the infrastructure will take care of that for you. Currently, the only language supported for writing the code is JavaScript and Cloud Functions executes these functions in a Node.js runtime environment.

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.

Although Google Cloud Functions currently supports only JavaScript, it should not be surprising to see them support more languages in the near future. Google Cloud Functions is currently available in Alpha and is by invite only. The pricing for the service has not been announced yet. You will need to be whitelisted in order to use the service. The application form is available here.

Amazon Web Services was the first to get out of the blocks with AWS Lambda, a zero-administration option to run your code in the cloud by writing small snippets of code called Lambda functions. AWS takes the task of running this code by provisioning EC2 instances. Lambda functions also has close integrations with other AWS services like DynamoDB, API Gateway, etc that helps to orchestrate complex functionality via AWS Lambda. At the time of writing AWS Lambda supports writing code in Java, JavaScript and Python.

Romin Irani Romin loves learning about new technologies and teaching it to others. His passion is to help developers succeed.

Comments