compute vm creation
Guides the planning, configuration, and provisioning of standalone Google Compute Engine virtual machines (VMs) and bare metal (-metal) instances using gcloud CLI commands or direct MCP tool execution. Use ONLY when the user wants to create, configure, or provision a new standalone Compute Engine VM or bare metal instance from conversational intents (hardware sizing, region selection, OS image, networking, security defaults). DO NOT read or use for Google Kubernetes Engine (GKE) Autopilot or Sta
Documentation & Preview
--- name: compute-vm-creation description: >- Guides the planning, configuration, and provisioning of standalone Google Compute Engine virtual machines (VMs) and bare metal (-metal) instances using gcloud CLI commands or direct MCP tool execution. Use ONLY when the user wants to create, configure, or provision a new standalone Compute Engine VM or bare metal instance from conversational intents (hardware sizing, region selection, OS image, networking, security defaults). DO NOT read or use for Google Kubernetes Engine (GKE) Autopilot or Standard clusters, Kubernetes node pools or Pods, container orchestration, managing existing VMs, Managed Instance Groups (MIGs), or Instance Templates. metadata: version: "1.0.0" category: Compute
---
Compute Engine VM Creation
This skill provides an interactive, intent-based experience for provisioning standalone Google Compute Engine VM and bare metal (-metal) instances. It supports users ranging from beginners asking to "create a VM" to cloud engineers requiring customized infrastructure, mapping natural language intents to secure Compute Engine configurations grounded in the Golden Path.
> MCP Tools: list_instances, create_instance, get_instance_basic_info, > delete_instance, get_zone_operation, list_machine_types, > list_accelerator_types, list_images
Usage Attribution
MUST READ: Before executing any gcloud, REST API, or MCP command, you MUST read and follow the instructions in Usage Attribution. Never include attribution environment variables or User-Agent tags in generated scripts, Terraform, or copy-pasteable commands shown to the user.
---
Prerequisites
Ensure the following setup requirements are met before provisioning instances. Any host modifications (such as installing or updating the gcloud CLI, installing or configuring the Google Compute Engine MCP server, or modifying local environment configuration) must be explicitly approved by the user before execution.
- Cloud SDK Installation: Verify
gcloudis installed (gcloud --version,
Google Cloud SDK >= 480.0.0) only when executing live CLI commands. If missing or outdated, ask the user for explicit approval before installing or updating via Install the gcloud CLI.
- Compute Engine MCP Server: For direct MCP tool execution
(list_instances, create_instance, get_instance_basic_info, delete_instance, get_zone_operation, list_machine_types, list_accelerator_types, list_images), check whether the Compute Engine MCP tools are loaded in your active tool declarations, or ask the user for approval to configure the server following Use the Compute Engine MCP server.
- Billing Account: Confirm the target Google Cloud project has an active
billing account linked (required even when using Google Cloud Free Tier resources).
- Authentication: Authenticate your environment for CLI execution
(gcloud auth login), application/MCP SDKs (gcloud auth application-default login), or service account credentials (GOOGLE_APPLICATION_CREDENTIALS).
- Project Selection & API Enablement: Set the target project and enable the
Compute Engine API:
gcloud config set project {project_id}
gcloud services enable compute.googleapis.com- Required IAM Roles:
- Caller Roles:
roles/compute.instanceAdmin.v1(to create and manage
instances), roles/iam.serviceAccountUser (to attach {custom_service_account}), and roles/mcp.toolUser when invoking the Compute Engine MCP server.
- IAP SSH/RDP Access for Private (
--no-address) VMs: Connecting via
gcloud compute ssh {vm_name} --zone={zone} --tunnel-through-iap requires roles/iap.tunnelResourceAccessor plus a VPC firewall rule allowing TCP 22 (or 3389 for RDP) from IAP's forwarding range 35.235.240.0/20 (see Use IAP for TCP forwarding).
- Custom VM Service Account Setup: Fresh projects only contain the default
Compute Engine service account. If {custom_service_account} does not yet exist, create a dedicated least-privilege service account first (seeking user approval before granting IAM bindings):
gcloud iam service-accounts create {sa_name} \
--project={project_id} \
--display-name="{sa_display_name}"
gcloud projects add-iam-policy-binding {project_id} \
--member="serviceAccount:{sa_name}@{project_id}.iam.gserviceaccount.com" \
--role="roles/logging.logWriter"
gcloud projects add-iam-policy-binding {project_id} \
--member="serviceAccount:{sa_name}@{project_id}.iam.gserviceaccount.com" \
--role="roles/monitoring.metricWriter"---
Workflow
- Determine Execution Method & MCP Capability Boundary:
- Fast Conversational Intake (No Shell Probing on Missing Inputs): When a
user asks to configure or create a VM without providing mandatory inputs (project_id, vm_name, region/zone, or public vs. private networking), respond immediately after reading SKILL.md without running gcloud config list, gcloud --version, or any shell commands. Clarify that you can either execute provisioning once confirmed (Automated Execution) or provide copy-pasteable gcloud commands / JSON payloads (Manual Execution), recommend a sizing tier, and ask for the missing inputs in a single turn.
- MCP vs.
gcloudRouting Rule: Compute Engine MCP discovery tools
(list_instances, get_instance_basic_info, list_machine_types, list_accelerator_types, list_images, get_zone_operation) are ideal for read-only inspection. However, MCP create_instance (McpCreateInstanceRequest) accepts only eight flat top-level fields (project, zone, name, bare machineType, imageProject, imageFamily, guestAccelerators, maintenancePolicy) and hardcodes global/networks/default without --no-address, custom subnets, custom service accounts, Shielded VM flags, OS Login, Spot scheduling, or custom disk sizes/types. Route all hardened (--no-address, custom --subnet={subnet}, {custom_service_account}, Shielded VM, OS Login), Spot, custom-disk, 4th-gen Hyperdisk, and bare metal (-metal) creations to gcloud compute instances create (or REST instances.insert) rather than dropping security guardrails to fit create_instance. Use MCP create_instance only for default-VPC prototyping when default disk and service-account settings are explicitly acceptable.
- Gather Mandatory Inputs: ALWAYS ask the user for any missing inputs:
- Project ID (Ask directly if not provided in the prompt).
- VM Name (Offer a friendly default suggestion if unsure, e.g.,
my-first-web-server).
- Region & Zone (Explain *why* simply: *"Choosing a location closer to
you or your users reduces latency and makes things load faster."* Recommend us-central1 / us-central1-a if the user has no preference, and consult Regions and zones, GPU regions and zones, or Google Cloud locations only when verifying non-default regional availability):
gcloud config set compute/region {region}
gcloud config set compute/zone {zone}- Conversational Triage (Sizing, Generation & OS): Map the user's workload
to the Intent-Based Sizing Tiers and hardware generation defaults:
- Default OS images: Use
debian-12(debian-cloud) forE2,N2,
C3 virtualized, and C2D; use debian-13 (debian-cloud) for 4th-gen (C4, N4, X4) and bare metal (c3-standard-192-metal, c4-standard-288-metal, where debian-12 is unsupported); use debian-12-arm64 / debian-13-arm64 for Arm C4A; and use common-cu129-ubuntu-2404-nvidia-580 (deeplearning-platform-release) for G2 GPUs. Consult Operating system details and Bare metal instances only when selecting non-default OS images or bare metal SKUs.
- Storage by generation: Use
hyperdisk-balancedon 4th-gen (C4,N4,
C4A, C4D, M4, X4, A4) and bare metal (-metal) instances where pd-* disks are rejected (N4 supports hyperdisk-balanced and hyperdisk-throughput, not hyperdisk-extreme; H3 supports pd-balanced and hyperdisk-balanced). Consult the *"Machine series support for Hyperdisk"* section of About Google Cloud Hyperdisk only for non-default disk types.
- Determine Network Accessibility & Subnet: ALWAYS ask in plain,
non-technical language whether the VM needs to be reachable from the public internet or kept private, noting that private networking (--no-address) is the security best practice—even when hosting a website or web app. Use --subnet={subnet} (verifying whether a custom/Shared VPC subnet or default VPC exists, since many enterprise projects enforce constraints/compute.skipDefaultNetworkCreation).
- Configure Security, OS Login & Service Accounts: Enable IAM-governed SSH
via --metadata=enable-oslogin=TRUE, recommend a custom least-privilege service account ({custom_service_account}), and enable Shielded VM flags (--shielded-secure-boot, --shielded-vtpm, --shielded-integrity-monitoring) on virtualized VMs (on standard x86 -metal bare metal instances, pass --no-shielded-secure-boot and omit vTPM/integrity flags).
- Summarize & Confirm (Mode-Aware): Present a clear summary of the proposed
VM configuration, cost profile, and architectural warnings:
- Automated Execution Mode: Always ask for explicit user confirmation
before executing any mutating provisioning command or tool call (e.g.,
*"Would you like me to proceed with provisioning this configuration, or adjust any settings first?"*).
- Manual /
"Do not execute"Mode: Instruct the user to review and
substitute any {snake_case} placeholders (such as {subnet} or {custom_service_account}) before running the command in their terminal; do not offer to execute provisioning when tools are disconnected or execution was forbidden.
- Execute or Deliver Payloads:
- Automated: Execute
gcloud compute instances create(prefixed with
CLOUDSDK_METRICS_REQUEST_ATTRIBUTION per Usage Attribution) for hardened/Spot/4th-gen/ bare-metal configurations, or call MCP create_instance for default-VPC prototyping, tracking progress via get_zone_operation and verifying via get_instance_basic_info.
- Manual: Output formatted, copy-pasteable
gcloudCLI commands (without
--quiet or attribution prefixes) or JSON payloads with clear instructions.
- Verify, Deliver Next Steps & Teardown Guidance: Provide post-provisioning
access steps (for example, via --tunnel-through-iap with gcloud compute ssh) and always include teardown instructions (omitting --quiet so interactive confirmation prevents accidental data loss; see [Delete a VM](https://docs.cloud.google.com/compute/docs/instances/de