Trying out Function as a Service — With Google Function

It’s 2017 and the keyword “serverless”, “ go serverless” or “Function as a service — FasS” is not something strange anymore.

First impression, awesome documentation.

Google function documentation

Google function documentation

Sure, we would want to “Quick Start”

And I love commandline tool, so …

Google Cloud Commandline tools

Google Cloud Commandline tools

Yay, step by step instructions:

step by step

step by step

All given steps above completed.

After installing cloud SDK, make sure gcloud was loaded into your shell environment.

When you initialize your cloud sdk, you will be guided through the process of authentication with your Google Account and authorizing the project to be manipulated with gcloud.

Now create a new project:

mkdir faas-testing-hello-world

with 1 index.js file vim index.js

Create index.js with vim

Create index.js with vim

According to the documentation, we will need to create a BUCKET for deployment.

gsutil mb -p gs://faas-testing-hello-world

Let’s deploy:

gcloud beta functions deploy newsSources — stage-bucket faas-testing-hello-world — trigger-http

trigger-http is one of many ways that defined how our function will be invoked. In this case, a http call will trigger this function. This will take a while

Deploy function to cloud

Deploy function to cloud

Done, your function should be shown up on Function listing

Google function listing

Google function listing

That’s it! Now it’s time for your imagination to add more features without worrying about infrastructure, maintenance, scaling, etc.

Originally published at https://medium.com/@toantran/trying-out-function-as-a-service-with-google-function-183425ee78b6

5 (100%) 6 votes