VM Snooze SousChef

GCP Stopped InstancesLister

Professional PowerShell script that discovers and analyzes stopped compute instances across Google Cloud Platform projects. Fast gcloud CLI integration with comprehensive CSV + HTML reporting for resource optimization.

Quick Start
# List all stopped instances
.\GCP-StoppedInstances.ps1
# Filter by age (30+ days)
.\GCP-StoppedInstances.ps1 -MinDays 30
# Specific projects
.\GCP-StoppedInstances.ps1 -ProjectIds "project1,project2"

PowerShell + gcloud CLI Excellence

Comprehensive analysis and reporting for stopped GCP compute instances with enterprise-grade performance

gcloud CLI Integration

Native integration with Google Cloud CLI for authenticated access and reliable data retrieval

Parallel Processing

High-performance parallel scanning across projects and zones with configurable concurrency limits

Multi-Project Discovery

Automatically discovers all accessible projects or targets specific projects for focused analysis

Zone Intelligence

Smart zone discovery with filtering capabilities and support for zone-specific targeting

Owner Detection

Extracts owner information from GCP labels for accountability and lifecycle management

Age Analysis

Calculates days since instance creation with configurable age-based filtering for lifecycle decisions

Dual Report Formats

Generates both CSV (for analysis) and HTML (for executive reporting) with comprehensive breakdowns

Performance Tracking

Real-time progress tracking with performance metrics and API call monitoring

Usage Examples

Real-world scenarios for GCP instance lifecycle management and optimization

Complete Organization Scan

.\GCP-StoppedInstances.ps1

Discovers all stopped instances across your entire GCP organization with automatic project and zone discovery.

Age-Based Filtering

.\GCP-StoppedInstances.ps1 -MinDays 30

Focuses on instances stopped for 30+ days for lifecycle management and potential cleanup decisions.

Targeted Project Analysis

.\GCP-StoppedInstances.ps1 -ProjectIds "project1,project2"

Analyzes specific projects for focused resource management and compliance reporting.

Zone-Specific Scanning

.\GCP-StoppedInstances.ps1 -Zones "us-central1-a,us-east1-b"

Limits analysis to specific zones for targeted optimization and reduced API calls.

Technical Specifications

Enterprise-grade PowerShell script with comprehensive GCP instance discovery capabilities

Requirements

PowerShell 5.1+

Modern PowerShell with parallel job support and advanced cmdlets

Google Cloud SDK

gcloud CLI installed and configured with proper authentication

GCP Authentication

Active gcloud authentication with access to target projects

IAM Permissions

Compute Engine Viewer role or equivalent permissions across target projects

Network Connectivity

Internet access to Google Cloud API endpoints

Command Line Parameters

-ProjectIds

Comma-separated list of GCP project IDs to scan

-Zones

Comma-separated list of specific zones to scan

-MinDays

Minimum days since creation to include instances (default: 0)

-MaxConcurrent

Maximum number of concurrent operations (default: 10)

-SkipZones

Comma-separated list of zones to skip during scanning

Core Features

Discovery Engine

  • • Automatic project and zone discovery via gcloud CLI
  • • Parallel processing with configurable concurrency limits
  • • PowerShell job-based parallel execution
  • • Comprehensive error handling and retry logic

Data Processing

  • • Instance age calculation with timezone handling
  • • Owner extraction from GCP labels and tags
  • • Machine type, region, and zone analysis
  • • Disk size calculation and storage analysis

Reporting Capabilities

  • • CSV export for data analysis and integration
  • • Rich HTML reports with visual breakdowns
  • • Age distribution analysis with priority levels
  • • Project and region distribution charts

Performance Optimization

  • • Concurrent gcloud API calls with job management
  • • Progress tracking and performance metrics
  • • Configurable concurrency limits for rate limiting
  • • Memory-efficient data processing and aggregation

Comprehensive Reporting

Professional reporting in multiple formats with detailed analytics and visual breakdowns

CSV Data Export

Structured CSV export optimized for data analysis, filtering, and integration with business intelligence tools.

Instance details and configuration
Age analysis and creation timestamps
Owner information from label analysis
Project and zone organization
Machine type and disk size details

HTML Executive Report

Rich HTML report with visual analytics, age distribution charts, and executive-friendly presentation for stakeholder communication.

Executive summary with key metrics
Age distribution with priority levels
Project and region breakdowns
Top oldest instances analysis
Performance metrics and API statistics

Chef's Tips & Best Practices

Professional recommendations for effective GCP instance lifecycle management

gcloud CLI Setup

Ensure gcloud is properly authenticated and configured before running the script. Like prepping your kitchen tools, proper setup ensures smooth operation.

Performance Tuning

Start with 5-10 concurrent jobs for large organizations to balance speed and API rate limits. Like managing multiple burners, find the right balance for your environment.

Project Strategy

Use project filtering for focused analysis or to avoid projects with restricted access. Target specific projects like a chef selecting ingredients from trusted suppliers.

Age-Based Filtering

Start with 30+ day filters for initial cleanup identification. Like aging ingredients, some instances need time, but others may be forgotten and ready for cleanup.

Owner Engagement

Use the owner detection to reach out before cleanup decisions. The script identifies owners through GCP labels, enabling proactive communication about instance lifecycle.

Report Integration

Import CSV reports into analytics tools for trend analysis. The structured output enables executive dashboards and automated lifecycle management workflows.

Ready to Optimize Your GCP Resources?

Download the GCP Stopped Instances Lister and start identifying optimization opportunities in your Google Cloud Platform today. PowerShell + gcloud CLI excellence for comprehensive instance discovery.