Skip to content

About

Capacity Tooling for Google Cloud

Resources

Stars

3 stars

Watchers

1 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Capacity Tooling for Google Cloud


Tools

greedy-reservations.sh

Google Cloud Greedy Reservation Creator

Acquires Google Compute Engine VM capacity in constrained zones by greedily reserving instances one node at a time until a target node count is reached. This is especially useful for high-demand machine types (e.g., GPUs, specialized compute) where bulk reservation creation requests might fail due to stockouts (ZONE_RESOURCE_POOL_EXHAUSTED).

Features

  • Interactive Startup: Prompts for required parameters while automatically detecting default project and zone values from your active gcloud configuration or existing environment variables.
  • Resource Naming Validation: Validates reservation names against Google Cloud resource naming rules prior to executing API calls.
  • Local & Shared Reservation Support: Supports both single-project (local) and multi-project (shared) reservations.
  • Greedy Acquisition Loop: Creates the reservation with 1 VM initially and continuously retries scaling up by 1 node at a time until the target node count is met.

Usage

Run interactively:

./greedy-reservations.sh

Or pre-populate defaults via environment variables:

PROJECT="my-project-id" \
ZONE="us-central1-b" \
MACHINE_TYPE="g4-standard-48" \
./greedy-reservations.sh

greedy-ondemand.sh

Google Cloud Greedy On-Demand VM Creator

Acquires standard on-demand Google Compute Engine VM instances in capacity-constrained zones by retrying instance creation one VM at a time until the target instance count is achieved.

Features

  • Instance Naming & Prefix Indexing: Prompts for a VM name prefix (INSTANCE_PREFIX) and creates indexed instances (${PREFIX}-1, ${PREFIX}-2, etc.). Automatically checks if an indexed instance already exists before attempting creation.
  • Dynamic Maintenance Policy Auto-Detection: Inspects the selected machine type prefix. Automatically applies --maintenance-policy=TERMINATE for GPU instance families (g2-, g4-, a2-, a3-) while defaulting to live migration (MIGRATE) for standard CPU instances.
  • OS Image & Boot Disk Customization: Prompts for Boot Image Family, Image Project, Boot Disk Size, and Disk Type (defaulting to Debian 12 / 50GB balanced disk).
  • Network / Subnet Configuration: Optional subnet specification or fallback to the project's default VPC network.
  • Transparent Error Reporting: Outputs exact gcloud error messages directly to console before retrying, distinguishing fatal configuration or quota errors from capacity stockouts (ZONE_RESOURCE_POOL_EXHAUSTED).

Usage

Run interactively:

./greedy-ondemand.sh

Or pre-populate defaults via environment variables:

PROJECT="my-project-id" \
ZONE="us-central1-b" \
MACHINE_TYPE="g4-standard-48" \
TARGET_COUNT="2" \
./greedy-ondemand.sh

About

Capacity Tooling for Google Cloud

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages