A cheatsheet of commands that I always forget
Creating Python virtual environment
python3 -m venv .venvsource .venv/bin/activatepip3 install google-adk==1.8.0 # packages
GCP authentication
- Authorize:
gcloud auth login - ADC login:
gcloud auth application-default login - Set project:
gcloud config set project weizhong-project03 - (Set quota project:
gcloud auth application-default set-quota-project weizhong-project03) - (See current project:
gcloud config list)
GCP add IAM policy binding
gcloud projects add-iam-policy-binding <PROJECT_ID> --member="<SERVICE ACCOUNT>" --role="roles/<ROLE>" --project=<PROJECT_ID>
Set environment variables
source ./set_vars.sh- Example
set_vars.sh
export GOOGLE_CLOUD_LOCATION="us-central1" # Example location
Add environment variables into bash profile
echo 'export GOOGLE_CLOUD_PROJECT="<PROJECT_ID>"' >> ~/.bash_profileecho 'export GOOGLE_CLOUD_LOCATION="REGION_ID"' >> ~/.bash_profileecho 'export GOOGLE_GENAI_USE_VERTEXAI=true' >> ~/.bash_profilesource ~/.bash_profile
ADK
- Create a new agent:
adk create <agent_name>
List of git commands that I always forget
Python
- Use
dirto see all properties and methods of the specified object, without the values. This function will return all the properties and methods, even built-in properties which are default for all object.
Dev notes
- Vertex AI workbench instance needs a defined network in GCP project
- (User-managed and Managed notebooks are deprecated and no longer supported.)
- Create VPC using auto-mode
Secure bootin Machine Type- Added instance to organization policy
constraints/compute.vmExternalIpAccess:Override parent's policy->Replace parent->Allow->projects/<PROJECT_NAME>/zones/us-central1-a/instances/<INSTANCE_NAME>