List out the commands used for performing various tasks in Google Cloud Console.
-
List credentialed accounts
gcloud auth list
-
If the desired account is not set, set an existing account to be the current active account.
- Suppose the desired account is abc@gmail.com)
gcloud config set core/account abc@gmail.com
-
Set the default region.
- Suppose the default region is europe-west1)
gcloud config set run/region europe-west1
-
Create a project.
- Suppose the project ID is portfolio-website-123456.
gcloud projects create portfolio-website-123456
-
Enable Billing.
-
Set project ID.
- Suppose the project ID is portfolio-website-123456.
gcloud config set project portfolio-website-123456
The environment variable $GOOGLE_CLOUD_PROJECT is then automatically set. Print out the project ID using the following command.
echo $GOOGLE_CLOUD_PROJECT
-
Set Zone.
- Suppose the desired zone is europe-west1-d.
gcloud config set compute/zone europe-west1-d
- View setting.
gcloud config list
-
Enable Cloud Run API.
gcloud services enable run.googleapis.com
-
Build docker image and upload to Google Container Registry.
gcloud builds submit --tag gcr.io/$GOOGLE_CLOUD_PROJECT/website
-
List docker images in Google Container Registry.
gcloud container images list
-
Deploy to Cloud Run.
gcloud run deploy portfolio-website \ --image gcr.io/$GOOGLE_CLOUD_PROJECT/website:latest \ --platform managed \ --region europe-west1 \ --allow-unauthenticated