Compute On Demand Reservations
GoogleOfficialPublished by Google
- Skill
- Tool integration
- Cloud and DevOps
- Apache-2.0
- Medium risk
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
The compute-on-demand-reservations skill provides a structured approach to inspecting, verifying, and managing Google Compute Engine (GCE) On-Demand reservations. It enables users to monitor consumed versus available capacity, verify reservation targeting policies, and manage cross-project sharing settings. The skill emphasizes operational safety by requiring explicit human approval for all mutating actions and provides clear guidance on avoiding common pitfalls like silent double-billing and property mismatches.
What it does
- Lists and describes active GCE On-Demand reservations within specified projects and zones.
- Calculates available reserved capacity by comparing assured counts against current usage.
- Facilitates the creation, resizing, and deletion of On-Demand reservations.
- Configures and manages cross-project reservation sharing settings.
- Provides guidance on matching VM properties to reservation requirements to ensure successful consumption.
- Implements operational guardrails for billing awareness and safe command execution.
When to use it
- When you need to verify if sufficient reserved capacity exists before launching new workloads.
- When troubleshooting why a VM failed to consume an existing reservation.
- When managing shared capacity across multiple projects within an organization.
- When you need to audit current reservation utilization to identify unused or exhausted capacity.
- When provisioning new reserved capacity for stable, non-interruptible workloads.
Advantages
- Prevents silent double-billing by identifying exact property matching requirements.
- Ensures operational safety through mandatory human-approval workflows for all mutations.
- Provides clear visibility into reservation health and consumption metrics.
- Simplifies complex cross-project reservation management.
- Reduces risk of misconfiguration by highlighting immutable hardware attributes.
Usage examples
- “List all reservations in the us-central1-a zone for my project.”
- The agent executes a gcloud command to retrieve and display a table of reservations, including their status, machine types, and current consumption counts.
- “Check if I have enough reserved capacity for 5 more n1-standard-4 instances.”
- The agent inspects the relevant reservation's assuredCount and inUseCount to report the remaining available capacity and confirms if the request can be fulfilled.
- “Create a new reservation for 10 n2-standard-8 VMs in us-central1-a.”
- The agent provides the exact gcloud command with all necessary flags, warns about immediate billing implications, and requests explicit user approval before execution.
- “How do I share my reservation with another project?”
- The agent explains the shareSettings requirements and provides the gcloud compute reservations update command to add the consumer project ID to the reservation.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/google/compute-on-demand-reservations/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip compute-on-demand-reservations.zip -d .agents/skills
Documentation by Google
Compute Engine On-Demand Reservations
The compute-on-demand-reservations skill inspects and manages active Google Compute Engine (GCE) On-Demand reservations. It determines whether guaranteed capacity is available, calculates consumption, verifies instance targeting policies, and audits cross-project sharing.
Usage Attribution
MUST READ: Before executing any gcloud, REST API, or MCP command, you MUST read and follow the instructions in Usage Attribution.
Prerequisites, IAM & Billing
Before querying or managing On-Demand reservations, ensure the environment meets these requirements:
Project & Region Configuration: Prefer passing
--project={project_id}and--zone={zone}directly on each command to avoid overwriting global workstation state, or obtain explicit user confirmation before setting defaults (e.g.,us-central1/us-central1-a):gcloud config set project {project_id} gcloud config set compute/region {region} gcloud config set compute/zone {zone}Billing & API Enablement: Ensure the project has an active billing account attached and the Compute Engine API is enabled:
gcloud services enable compute.googleapis.com --project={project_id}Cloud SDK & Authentication: Ensure the Google Cloud CLI is installed (never execute unprompted host installation commands such as
apt-getorcurl | bashwithout explicit user approval; direct the user to the installation guide instead), then authenticate viagcloud auth login(for interactive CLI),gcloud auth application-default login(for SDKs), orGOOGLE_APPLICATION_CREDENTIALS(for service accounts).IAM Permissions:
Read-Only Inspection (
list,describe): Grantroles/compute.viewer(or custom role withcompute.reservations.listandcompute.reservations.get).Reservation Lifecycle (
create,update,delete): Grantroles/compute.admin(or custom role withcompute.reservations.create,compute.reservations.resize,compute.reservations.update, andcompute.reservations.delete).Consuming Reservations (
instances create): Grantroles/compute.instanceAdmin.v1on the project launching VMs (and on both the host/owner project and the consumer project when consuming a shared reservation).
Quota & Organization Policy: Creating an On-Demand reservation immediately consumes regional CPU, GPU, or Local SSD quota. For shared reservations, Compute Engine deducts regional quota in both the host project (at reservation creation) and the consumer project (when VMs launch), and requires the host project to be allowlisted in organization policy
constraints/compute.sharedReservationsOwnerProjects.Billing & Pricing Warning: On-Demand reservations are billed immediately upon creation at the full On-Demand VM rate whether or not VMs are running and consuming the reservation. Review Compute Engine Pricing, Available Regions and Zones, and Google Cloud Locations (strip
.md.txtsuffixes when presenting documentation URLs to human users) before provisioning.
Command Syntax & Reference
1. List Reservations in a Project / Zone
gcloud compute reservations list \
--project={project_id} \
[--zones={zone}] \
[--format="table(name,zone.basename(),specificReservation.instanceProperties.machineType.basename(),specificReservation.assuredCount,specificReservation.inUseCount,specificReservation.count,specificReservationRequired,shareSettings.shareType,status)"]2. Inspect Reservation Details & Capacity Metrics
gcloud compute reservations describe {reservation_name} \
--zone={zone} \
--project={project_id}(Note: Dense accelerator reservations backed by aggregateReservation leave specificReservation.* columns blank in list and expose aggregateReservation.totalResources and aggregateReservation.inUseResources via describe.)
3. Create a New On-Demand Reservation
[!IMPORTANT] Creating a reservation immediately incurs billing charges. Always obtain explicit human approval before executing
gcloud compute reservations create.
gcloud compute reservations create {reservation_name} \
--project={project_id} \
--zone={zone} \
--vm-count={vm_count} \
(--machine-type={machine_type} | --source-instance-template={template_name}) \
[--min-cpu-platform={min_cpu_platform}] \
[--accelerator=count={gpu_count},type={gpu_type}] \
[--local-ssd=interface={nvme|scsi}] \
[--require-specific-reservation] \
[--share-setting=projects --share-with={consumer_project_ids}] # up to 100 consumer projects in the same org (excluding the host project)4. Update or Resize an Existing Reservation
Resizing capacity (--vm-count) and modifying shared consumer projects are mutable in place after obtaining explicit human approval (--share-with and --add-share-with accept up to 100 consumer project IDs or project numbers in the same organization excluding the host project itself, while --remove-share-with strictly requires numeric project numbers). Hardware attributes (machineType, minCpuPlatform, accelerator, localSsd, zone, and specificReservationRequired) are immutable after creation and require recreating the reservation.
gcloud compute reservations update {reservation_name} \
--project={project_id} \
--zone={zone} \
[--vm-count={new_vm_count}] \
[--add-share-with={project_ids_or_numbers} | --remove-share-with={project_numbers}]5. Delete an Unused On-Demand Reservation (Resource Teardown)
To stop ongoing billing for an unused On-Demand reservation, delete it after obtaining explicit human approval (note: deletion fails if the reservation is attached to a resource-based Committed Use Discount where commitment is set—which must be swapped via gcloud beta compute commitments update-reservations—or if a targeted reservation with specificReservationRequired: true still has inUseCount > 0; the command also prompts interactively unless --quiet is passed):
gcloud compute reservations delete {reservation_name} \
--zone={zone} \
--project={project_id}Capacity Utilization Analysis
When inspecting reservation output, verify that the reservation status is READY or UPDATING (exclude reservations in CREATING or DELETING states) and calculate available capacity using the following fields:
status: Must beREADYorUPDATINGbefore instances can consume reserved capacity. While a reservation isUPDATING(for example, during a capacity resize or share-setting modification), its already provisioned capacity remains consumable up tospecificReservation.assuredCount. OnlyCREATINGandDELETINGstates block consumption.specificReservation.assuredCount: The number of reserved VM instances currently provisioned and physically backed by Compute Engine hardware. Note thatassuredCountcan be less thanspecificReservation.countwhile a reservation is actively upsizing or if a physical host failure degrades the reservation (healthInfo.healthStatus: DEGRADED).specificReservation.count: The total requested target number of VM instances in this reservation block.specificReservation.inUseCount: The number of reserved instances currently consumed by running VMs.Available Reserved Capacity:
Available Capacity = specificReservation.assuredCount - specificReservation.inUseCount
Health & Consumption Thresholds
Available (
> 0): Provisioned reserved capacity is immediately available. Workloads can launch with 100% provisioning assurance.Exhausted (
inUseCount >= assuredCount): Provisioned reserved capacity is fully consumed. New instances matching this specification fall back to unreserved on-demand capacity (if allowed) or fail to launch.
Reservation Targeting Policies
Reservations operate under two distinct consumption modes defined by specificReservationRequired:
| Setting | Consumption Mode | Matching Behavior |
|---|---|---|
specificReservationRequired: false | Automatic (ANY_RESERVATION) | Any newly created STANDARD VM whose properties identically match all reserved instanceProperties automatically consumes this reservation. |
specificReservationRequired: true | Targeted (SPECIFIC_RESERVATION) | VMs do not consume this capacity unless they match all reserved instanceProperties and explicitly specify --reservation-affinity=specific --reservation={reservation_name}. |
Exact Hardware & Property Matching Requirement
For a VM to consume a reservation (under either ANY_RESERVATION or SPECIFIC_RESERVATION), every property below must match the reservation's specificReservation.instanceProperties 100% identically:
Project and
zone: Same project forLOCALreservations, or an authorized consumer project listed inshareSettings.projectMap, in the exact samezone.machineType: Exact machine type shape.minCpuPlatform: Must match verbatim. If the reservation was created without an explicit CPU platform ("Automatic"), passing--min-cpu-platformon the VM does not match (and vice versa).guestAccelerators: Exact GPUacceleratorTypeandacceleratorCount(if any).localSsds: Exact Local SSD partition count and exact storage interface (NVMEversusSCSI, if any).Placement policies: Exact compact placement
resourcePoliciesandlocationHint(if present on the reservation).provisioningModel: Must beSTANDARD(SPOTVMs never consume On-Demand reservations).
[!WARNING] Silent Double-Billing Trap: Under
ANY_RESERVATION(--reservation-affinity=any, the default), if a newly created VM matcheszoneandmachineTypebut differs on even a single property (such asNVMEvs.SCSILocal SSD interface orminCpuPlatform), Compute Engine silently skips the reservation, launches an unreserved On-Demand VM, and bills for both the idle reservation and the new VM. Creating both the reservation and VMs from the same--source-instance-templateprevents property drift.
VM Provisioning Best Practices
When provisioning VMs, recommend private networking (--no-address paired with IAP TCP forwarding) and a custom least-privilege service account (--service-account):
To consume a targeted reservation (
specificReservationRequired: true) during instance creation (note: passing--reservation-affinity=specificagainst a reservation withspecificReservationRequired: falseis rejected by Compute Engine):gcloud compute instances create {vm_name} \ --project={project_id} \ --zone={zone} \ --machine-type={machine_type} \ --reservation-affinity=specific \ --reservation={reservation_name} \ [--no-address] \ [--service-account={service_account_email}]To prevent an instance from consuming any reservation:
gcloud compute instances create {vm_name} \ --project={project_id} \ --zone={zone} \ --machine-type={machine_type} \ --reservation-affinity=none \ [--no-address] \ [--service-account={service_account_email}]
Cross-Project Shared Reservations
Shared reservations allow multiple projects within the same Google Cloud organization to draw from a shared pool of reserved capacity.
Inspect
shareSettings:shareType: LOCAL: Reservation is private to the host project.shareType: SPECIFIC_PROJECTS: Shared with specific consumer projects keyed underprojectMap(mapping each project ID or number to{"projectId": "..."}).
Visibility & CUD Caveats:
Running
gcloud compute reservations list --project={consumer_project_id}in a consumer project never displays shared reservations owned by a host project; always query--project={host_project_id}(or Cloud Asset Inventory) to inspectassuredCountandinUseCount.Committed Use Discount (CUD) pricing only covers shared reservation consumers when the host and consumer projects belong to the same Cloud Billing account.
Consumer projects consume shared capacity by specifying
--project={consumer_project_id}and referencing the host project in--reservation:gcloud compute instances create {vm_name} \ --project={consumer_project_id} \ --zone={zone} \ --machine-type={machine_type} \ --reservation-affinity=specific \ --reservation=projects/{host_project_id}/reservations/{reservation_name} \ [--no-address] \ [--service-account={service_account_email}]
Operational Guardrails & Recommendations
Human-Approval Guardrail: Never execute mutating commands (
gcloud compute reservations create,gcloud compute reservations update,gcloud compute reservations delete, orgcloud compute instances create) without explicit human approval from the user. Provide copy-pasteable commands and highlight billing implications first.Compute Engine MCP Server Guardrail: When the Compute Engine MCP server is enabled, inspect the in-session MCP tool schemas before invoking them (in case newer MCP server versions add support); unless verified in the current schema:
MCP
list_reservationsis single-zone only and stripsspecific_reservationcounts/shape andshare_settings(callget_reservation_detailsper reservation or usegcloud compute reservations list).No MCP tools exist to create, update, or delete reservations.
MCP
create_instanceomitsreservation_affinity,min_cpu_platform, andlocal_ssd(cannot targetSPECIFIC_RESERVATIONor shared reservations and risks silent unreserved double-billing); fall back togcloudCLI when these parameters are absent from the tool schema.
Missing Reservation Advisory: When no matching or available reservation exists in the target zone:
Inform the user that instances launch against unreserved on-demand capacity (subject to stock availability).
If guaranteed capacity is required, advise creating a new reservation using
gcloud compute reservations create.If the workload is interruptible or fault-tolerant, suggest evaluating Spot VMs using
compute-spot-capacity-advice.
Negative Guardrail (No Spot Telemetry for On-Demand): Do not use Spot capacity advice (
gcloud beta compute advice capacity --provisioning-model=SPOT) or emit obtainability scores when inspecting or verifying standard On-Demand reservations. On-Demand reservation checks must inspect concrete reservation status and counts viagcloud compute reservations listanddescribe.
Files
- ATTRIBUTION.mdAdded by AutoGineer878 B
- LICENSELicence file added by AutoGineer11.1 KiB
- SKILL.md15.2 KiB
- references/attribution.md1.8 KiB
LICENSE
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs an MCP server, Needs a command-line tool
Security
What our scanner noticed· Medium risk
- Downloads piped into a shell
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Publisher
- Google (Official)
- Source
- google/skills · skills/cloud/compute-on-demand-reservations · commit 2194d3b
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Google or Google.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download compute-on-demand-reservations.zip