You don't need these instructions if you use WSL. It's only for "plain Windows"
- For this tutorial, you'll need a Linux-like environment, e.g. GitBash, MinGW or cygwin
- Power Shell should also work, but will require adjustments
- Download SDK in zip: https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.zip
- Unzip it and run the
install.sh
script
When installing it, you might see something like that:
The installer is unable to automatically update your system PATH. Please add
C:\tools\google-cloud-sdk\bin
- To fix that, adjust your
.bashrc
to include this inPATH
(instructions) - You can also do it system-wide (instructions)
Now we need to point it to correct Python installation. Assuming you use Anaconda:
export CLOUDSDK_PYTHON=~/Anaconda3/python
Now let's check that it works:
$ gcloud version
Google Cloud SDK 367.0.0
bq 2.0.72
core 2021.12.10
gsutil 5.5
- Now create a service account and generate keys like shown in the videos
- Download the key and put it to some location, e.g.
.gc/ny-rides.json
- Set
GOOGLE_APPLICATION_CREDENTIALS
to point to the file
export GOOGLE_APPLICATION_CREDENTIALS=~/.gc/ny-rides.json
Now authenticate:
gcloud auth activate-service-account --key-file $GOOGLE_APPLICATION_CREDENTIALS
Alternatively, you can authenticate using OAuth like shown in the video
gcloud auth application-default login
If you get a message like quota exceeded
WARNING: Cannot find a quota project to add to ADC. You might receive a "quota exceeded" or "API not enabled" error. Run
$ gcloud auth application-default set-quota-project
to add a quota project.
Then run this:
PROJECT_NAME="ny-rides-alexey"
gcloud auth application-default set-quota-project ${PROJECT_NAME}
- Download Terraform
- Put it to a folder in PATH
- Go to the location with Terraform files and initialize it
terraform init
Optionally you can configure your terraform files (variables.tf
) to include your project id:
variable "project" {
description = "Your GCP Project ID"
default = "ny-rides-alexey"
type = string
}
- Now follow the instructions
- Run
terraform plan
- Next, run
terraform apply
- Run
If you get an error like that:
Error: googleapi: Error 403: terraform@ny-rides-alexey.iam.gserviceaccount.com does not have storage.buckets.create access to the Google Cloud project., forbidden
Then you need to give your service account all the permissions. Make sure you follow the instructions in the videos
- You can also use this file, but it doesn't list all the required permissions