The Serverless Framework needs access to account credentials for your Google Cloud account so that it can create and manage resources on your behalf.
You need a Billing Account with a credit card attached to use Google Cloud Functions. Here's how to create one:
If necessary, a more detailed guide on creating a Billing Account can be found here.
A Google Cloud Project is required to use Google Cloud Functions. Here's how to create one:
You need to enable the following APIs so that Serverless can create the corresponding resources.
Go to the API dashboard, select your project and enable the following APIs (if not already enabled):
You can either use a Service Account or directly your Google Account with appropriate roles that Serverless can use to create resources in your project.
(Google Accounts are real users who can be authenticated by the Google SSO)
This method is the most convenient to allow developers to develop and deploy a Serverless application locally.
If you are owner of the project you have nothing to do. Otherwise, make sure your user has at least the following roles:
Deployment Manager Editor
Storage Admin
Logging Admin
Cloud Functions Developer
(Service accounts are accounts for applications instead of individuals end users)
This method is useful for to authenticate a CI/CD or to assume a specific role without changing the roles of a Google Account.
Create a Service Account with at least the following roles:
Deployment Manager Editor
Storage Admin
Logging Admin
Cloud Functions Developer
How to create a Service Account:
IAM & admin
menu on left-sidebarService accounts
on left-sidebarCREATE SERVICE ACCOUNT
button on the topCreate
buttonDeployment Manager Editor
, Storage Admin
, Logging Admin
, Cloud Functions Developer
rolesDone
buttonThe Serverless Google Cloud plugin supports several authentication methods.
The plugin will let Google find the Application Default Credentials and implicitly authenticate.
To authenticate with a Google Account use gcloud cli login
gcloud auth application-default login
To authenticate with a Service Account:
IAM & admin
manage keys
GOOGLE_APPLICATION_CREDENTIALS
provider
config in serverless.yml
, add a credentials
attribute with the absolute path of the credentials keyfile:provider:
name: google
runtime: nodejs
project: my-serverless-project-1234
credentials: ~/.gcloud/keyfile.json # <- the path must be absolute
If provider.credentials
is provided in the serverless.yml
, the Application Default Credentials will be ignored.
Product