Skip to content

Hitamashi/gcp-instance-mgmt

Repository files navigation

GCP instance schedule

Build Status

General

Small project to schedule on/off for my gcp instance using cloud function + GAE cron job
While using cloud functions, GAE do not requires IAM config.

Deployment

  1. Install dependencies
pip install -r requirements.txt -t lib
  1. Setup environment variables
# Cloudfunction endpoint format https://[region]-[projectid].cloudfunctions.net/
export GCP_CLOUDFUNCTION_URL=<Endpoint to cloudfunctions>
export  GCP_DEFAULT_ZONE=<default zone>
export  GCP_INSTANCE_NAME=<the instance name>
  1. Run deployment script
    You need to setup Cloud SDK and App Engine SDK for Python.

Local deployment

# Deploy app on local port 8080
deploy.sh local 8080

GAE deployment

# Deploy app in GAE project abcxyz-123
deploy.sh remote abcxyz-123

References