Google Cloud Provider Overview

The officially supported Nitric Google Cloud Platform (GCP) Provider.

provider: nitric/gcp@latest

See the Overview page for general information on Nitric Pulumi providers.

The Google Cloud provider is supported by the Nitric SDKs and CLI by default. However, credentials for a Google Cloud account will be required when using the up command from the CLI.

Google Cloud Credentials

Authorize gcloud to access the Cloud Platform with Google user credentials:

gcloud auth application-default login

Google CLI Installation

Installing the Google Cloud CLI assists with credentials setup. You can install it using these summarized instructions, for more options see the Google docs.

Download & install the latest CLI release.

Create Billing Account

For Google Cloud to allow deployments, a billing account must be created and attached to the project you deploy to.

Stack Configuration

# The provider to use and it's published version
# See releases:
# https://github.com/nitrictech/nitric/tags
provider: nitric/gcp@latest
# The target GCP region to deploy to
# See available regions:
# https://cloud.google.com/run/docs/locations
region: my-gcp-stack-region
# ID of the google cloud project to deploy into
gcp-project-id: my-gcp-project-id
# All configuration below is optional
# The timezone that deployed schedules will run with
# Format is in tz identifiers:
# https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
schedule-timezone: Australia/Sydney
# Import existing GCP Resources
# Currently only secrets are supported
# Available since v1.4.0
import:
# A map of nitric names to GCP Secret Manager names
secrets: # Available since v1.4.0
# NOTE: Imported secrets must exist in the same project as specified by gcp-project-id
# In typescript this would import the provided secret reference for a secret declared as
# const mySecret = secret('my-secret');
my-secret: existing-secret
# Apply configuration to nitric APIs
apis:
# Target an API by its nitric name
my-api:
# provide domains to be used for the api
description: An Azure API
# Configure your deployed services
config:
# How services without a type will be deployed
default:
# configure services to deploy to Google Cloud Run
cloudrun:
# set 512MB of RAM
# See cloudrun configuration docs here:
# https://cloud.google.com/run/docs/configuring/memory-limits
memory: 512
# set a timeout of 15 seconds
# https://cloud.google.com/run/docs/configuring/request-timeout
timeout: 15
# The maximum number of instances to scale down to
# https://cloud.google.com/run/docs/configuring/min-instances
min-instances: 0
# The maximum number of instances to scale up to
# https://cloud.google.com/run/docs/configuring/max-instances
max-instances: 10
# Number of concurrent requests that each instance can handle
# https://cloud.google.com/run/docs/configuring/concurrency
concurrency: 80
# Additional deployment types
# You can target these types by setting a `type` in your project configuration
big-service:
cloudrun:
memory: 1024
timeout: 60
min-instances: 2
max-instances: 100
concurrency: 1000

Missing something? Let us know by raising an issue in GitHub or by dropping us a line on Discord

Last updated on Nov 4, 2024