- Region equals a geograpic location
- Zones divide regions into (physically) independent isolated sub parts
- Some resources are
- accessible only within one zone (e.g. VMs)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# ~/.ssh/gcp-start-iap-tunnel-ssh-proxy-magic.sh | |
# a script to be used as SSH ProxyCommand to allow fully functional SSH access to any Google Cloud Compute Engine VMs allowing IAP access | |
# | |
# Author: Jaeho Shin <[email protected]> | |
# Created: 2022-10-31 | |
# See also: | |
# - https://gist.github.com/netj/df4f9de1fefd254ab11979be7035b5d0/#readme | |
# - https://cloud.google.com/iap/docs/using-tcp-forwarding | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Navigation menu => Compute Engine => VM Instances => Create | |
# Identity and API access => Allow full access to all Cloud APIs. | |
# Firewall => Allow HTTP traffic | |
# SSH | |
sudo apt-get update | |
sudo apt-get install git | |
sudo apt-get install python-setuptools python-dev build-essential | |
sudo easy_install pip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import the os module | |
import os | |
# Use the os module to get the GCLOUD_PROJECT environment variable | |
project_id = os.getenv('GCLOUD_PROJECT') | |
from flask import current_app | |
# Import the datastore module from the google.cloud package. | |
from google.cloud import datastore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get the Bucket name from the GCLOUD_BUCKET environment variable | |
bucket_name = os.getenv('GCLOUD_BUCKET') | |
# Import the storage module | |
from google.cloud import storage | |
# Create a client for Cloud Storage | |
storage_client = storage.Client() | |
# Use the client to get the Cloud Storage bucket |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git clone https://github.com/GoogleCloudPlatform/training-data-analyst | |
cd ~/training-data-analyst/courses/developingapps/python/firebase/start | |
. prepare_environment.sh | |
python run_server.py | |
# Web preview > Preview on port 8080 to preview the Quiz application. | |
# Note Cloud Shell Web preview domain (in form: 8080-dot-2958229-dot-devshell.appspot.com) | |
# Create a Firebase project | |
# Develop > Authentication > Set up sign-in method > Email/Password > Enable | |
# Under Authorized Domains > Add Domain (in form: 8080-dot-2958229-dot-devshell.appspot.com) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a Cloud Pub/Sub topic | |
# In the Cloud Platform Console, click Navigation menu > Pub/Sub > Topics. | |
# Create a topic., eg "feedback" | |
gcloud pubsub subscriptions create worker-subscription --topic feedback | |
#Publish a message to a Cloud Pub/Sub topic | |
gcloud pubsub topics publish feedback --message "Hello World" | |
#Retrieve a message from a Cloud Pub/Sub subscription |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
##################################################################### | |
# REFERENCES | |
# - https://cloud.google.com/secret-manager/docs/create-secret-quickstart | |
# - https://cloud.google.com/secret-manager/docs/manage-access-to-secrets | |
# - https://cloud.google.com/secret-manager/docs/creating-and-managing-expiring-secrets | |
# - https://cloud.google.com/secret-manager/docs/secret-rotation | |
# - https://cloud.google.com/compute/docs/access/create-enable-service-accounts-for-instances | |
# - https://cloud.google.com/iam/docs/best-practices-service-accounts#single-purpose |
NewerOlder