Install Node and npm
Serverless framework
For windows: npm install -g serverless
For linux curl: o -L https://slss.io/install | bash
Integrate GCP with serverless
https://www.serverless.com/framework/...
Create service Account with Deployment Manager Editor, Storage Admin, Logging Admin, Cloud Functions Developer roles and download the file ( • Service Account for GCP (Google GCP) ... check out my video on service accounts )
Download the sample from serverless
https://github.com/serverless/example... or serverless create --template google-nodejs
In the Serverless.yml file change the two parameters marked in red to the appropriate values
provider:
name: google
runtime: 'nodejs8'
project: my-project-1234 #google account project name
credentials: ~/.gcloud/keyfile.json # Credentials created by service account
plugins:
serverless-google-cloudfunctions
Run npm install and sls deploy
To invoke function serverless invoke --function first
#gcp #serverless #gcpserverless