4 min read

Google Cloud Next conference in San Francisco in July 2018 saw some exciting new developments in the field of serverless technology. The company is giving development teams the ability to build apps without worrying about managing servers with their new serverless technology. Bringing the best of both worlds: Serverless and containers, Google announced that Cloud Functions is now generally available and ready for production use.

Here is a list of the all-new features that developers can watch out for-

#1 Write Cloud Functions using  Node 8, Python 3.7

With support for async/await and a new function signature, you can now write Cloud Functions using Node 8. Dealing with multiple asynchronous operations is now easier thanks to Cloud Functions that provide data and context. You can use the await keyword to await the results of asynchronous operations.

Python 3.7 can also be used to write Cloud Functions.  Similar to Node, you get data and context for background functions, and request for HTTP. Python HTTP functions are based on the popular Flask microframework. Flask allows you to get set up really fast.

The requests are based on flask.Request and the responses just need to be compatible with flask.make_response. As with Node, you get data (dict) with Python background functions and context (google.cloud.functions.Context). To signal completion, you just need to return from your function or raise an exception and Stackdriver error handling will kick in. And, similarly to Node (package.json), Cloud Functions will automatically do the installation of all of your Python dependencies (requirements.txt) and build in the cloud.

You can have a look at the code differences between Node 6 and Node 8 behavior and at a Flask request on the Google Cloud website.

#2 Cloud Functions is now out  for Firebase

Cloud Functions for Firebase is also generally available. It has full support for Node 8, including ECMAScript 2017 and async/await. The additional granular controls include support  for runtime configuration options, including region, memory, and timeout. Thus allowing you to refine the behavior of your applications. You can find more details from the Firebase documentation.
Flexibility for the application stack now stands improved. Firebase events (Analytics, Firestore, Realtime Database, Authentication) are directly available in the Cloud Functions Console on GCP. You can now trigger your functions in response to the Firebase events directly from your GCP project.

#3 Run headless Chrome by accessing system libraries

Google Cloud functions have also broadened the scope of libraries available by rebasing the underlying Cloud Functions operating system onto Ubuntu 18.04 LTS. Access to system libraries such as ffmpeg and libcairo2 is now available- in addition to imagemagick- as well as everything required to run headless Chrome. For example, you can now process videos and take web page screenshots in Chrome from within Cloud Functions.

#4 Set environment variables

You can now pass configuration to your functions by specifying key-value pairs that are bound to a function. The catch being, these pairs don’t have to exist in your source code. Environment variables are set at the deploy time using the –set-env-vars argument. These are then injected into the environment during execution time. You can find more details on the Google cloud webpage.

#5 Cloud SQL direct connect

Now connect Cloud Functions to Cloud SQL instances through a fully managed secure direct connection.  Explore more from the official documentation.

What to expect next in Google Cloud Functions?

Apart from these, Google also promises a range of features to be released in the future. These include:

1. Scaling controls

This will be used to limit the number of instances on a per-function basis thus limiting traffic. Sudden traffic surge scenarios will , therefore,come under control when Cloud Functions rapidly scales up and overloads a database or general prioritization based on the importance of various parts of your system.

2. Serverless scheduling

You’ll be able to schedule Cloud Functions down to one-minute intervals invoked via HTTP(S) or Pub/Sub. This allows you to execute Cloud Functions on a repeating schedule. Tasks like daily report generation or regularly processing dead letter queues will now pick up speed!

3. Compute Engine VM Access

Now connect to Compute Engine VMs running on a private network using –connected-vpc option. This provides a direct connection to compute resources on an internal IP address range.

4. IAM Security Control

The new Cloud Functions Invoker IAM role allows you to add IAM security to this URL. You can control who can invoke the function using the same security controls as used in Cloud Platform

5. Serverless containers

With serverless containers, Google provides the same infrastructure that powers Cloud Functions. Users will now be able to simply provide a Docker image as input. This will allow them to deploy arbitrary runtimes and arbitrary system libraries on arbitrary Linux distributions This will be done while still retaining the same serverless characteristics as Cloud Functions.

You can find detailed information about the updated services on Google Cloud’s Official page.

Read Next

Google Cloud Next: Fei-Fei Li reveals new AI tools for developers

Google Cloud Launches Blockchain Toolkit to help developers build apps easily

Zeit releases Serverless Docker in beta

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here