Meta tags:
description= Create reservations of Compute Engine VM instances that are shared by multiple projects.;
Headings (most frequently used words):
console, gcloud, rest, specify, create, shared, reservation, and, terraform, go, java, node, js, python, required, an, stay, organized, with, collections, save, categorize, content, based, on, your, preferences, before, you, begin, troubleshooting, what, next, roles, instance, template, existing, vm, properties, directly, products, pricing, support, resources, engage, permissions,
Text of the page (most frequently used words):
the (532), #reservation (243), create (233), and (207), for (171), with (163), vms (153), you (127), compute (120), projects (109), #instance (108), reservations (105), zone (105), that (90), project (82), use (81), using (69), cloud (65), share (64), troubleshoot (63), template (63), about (62), google (61), can (60), following (57), shared (56), your (55), disk (53), set (52), manage (50), gcloud (50), resources (48), this (48), delete (48), time (48), view (47), name (47), projectid (45), machine (43), disks (43), consume (40), request (39), select (39), local (39), server (39), type (38), operation (38), engine (36), count (35), specific (35), reservation_name (34), include (34), mig (34), configure (34), specify (33), windows (33), example (32), reserve (32), from (31), overview (31), number_of_vms (30), performance (30), sharesettings (29), project_id (29), gpu (29), default (29), consumer_project_id_2 (28), consumer_project_id_1 (28), com (27), properties (27), import (27), cli (27), more (26), organization (26), identity (26), post (25), zones (25), field (25), one (25), make (24), digit (24), section (24), want (24), replace (23), consumer (23), must (23), authentication (23), specific_projects (22), custom (22), instances (22), see (21), monitor (21), cpu (21), number (21), existing (21), access (21), hyperdisk (21), sql (21), sharetype (20), install (20), images (20), policies (19), https (19), projectmap (19), machine_type (19), automatically (19), add (19), application (19), network (19), page (18), creation (18), specificreservation (18), specifying (18), only (18), where (18), creating (18), owner (18), setting (18), then (18), string (18), credentials (18), information (17), are (17), googleapis (17), after (17), date (17), ssd (17), image (17), linux (17), duration (16), seconds (16), beta (16), formatted (16), offset (16), service (16), based (16), regional (16), terms (15), how (15), follows (15), which (15), available (15), global (15), environment (15), virtual (15), snapshots (15), groups (15), ssh (15), recommendations (15), configuration (15), enable (14), jobs (14), same (14), resource (14), consumer_project_ids (14), policy (14), region (14), persistent (14), development (14), external (14), provider (14), workload (14), host (14), load (14), apply (14), connect (14), samples (13), have (13), any (13), central1 (13), when (13), new (13), login (13), best (13), management (13), bulk (13), microsoft (13), cluster (13), two (12), platform (12), don (12), command (12), console (12), instance_template_url (12), reservationsclient (12), const (12), multiple (12), idp (12), federated (12), user (12), practices (12), storage (12), sole (12), availability (12), need (11), attach (11), body (11), minutes (11), let (11), reserved (11), interface (11), gpus (11), flag (11), run (11), options (11), reference (11), zonal (11), build (11), attached (11), workloads (11), stateful (11), details (10), commitments (10), method (10), separated (10), true (10), target (10), these (10), click (10), managed (10), created (10), templates (10), instancetemplates (10), client (10), error (10), reservationname (10), update (10), shell (10), metadata (10), migs (10), machines (10), migrate (10), logs (10), sign (9), other (9), instanceproperties (9), machinetype (9), insert (9), standard (9), 100 (9), optional (9), manually (9), regions (9), return (9), get (9), compute_v1 (9), running (9), roles (9), licenses (9), tenant (9), openshift (9), shutdown (9), start (9), hpc (9), training (8), code (8), support (8), java (8), license (8), day (8), delete_after_duration (8), hour (8), month (8), yyyy (8), delete_at_time (8), pre (8), allow_all (8), specifically (8), minimum (8), each (8), allowed (8), appears (8), auto (8), stop (8), sourceinstancetemplate (8), response (8), str (8), node (8), permissions (8), account (8), optimize (8), internal (8), choose (8), disaster (8), recovery (8), high (8), agent (8), guest (8), boot (8), keys (8), h4d (8), flexibility (8), dns (8), optimized (8), tpu (8), status (7), thumb (7), send (7), vertex (7), prediction (7), already (7), ids (7), without (7), terraform (7), list (7), services (7), match (7), group (7), single (7), print (7), during (7), will (7), wait (7), location (7), initialize (7), modify (7), err (7), proto (7), computepb (7), source (7), first (7), demand (7), across (7), networking (7), startup (7), balancing (7), benchmark (7), idle (7), addresses (7), scale (7), deploy (7), back (7), mysql (7), remove (7), maintenance (7), snapshot (7), backup (7), events (6), utc (6), learn (6), deleteafterduration (6), deleteattime (6), general (6), methods (6), nvme (6), 375 (6), predefined (6), define (6), flags (6), sharing (6), require (6), directly (6), complete (6), enter (6), matching (6), sys (6), file (6), newbuilder (6), requests (6), capacity (6), control (6), required (6), review (6), usage (6), security (6), migration (6), data (6), updates (6), instant (6), files (6), nested (6), applications (6), mode (6), pools (6), failover (6), extension (6), change (6), transfer (6), customized (6), spot (6), understand (5), consumption (5), while (5), might (5), specificreservationrequired (5), values (5), interface_type (5), rest (5), verify (5), allow (5), configurations (5), uses (5), sharesettingsprojectconfig (5), allocationspecificskureservation (5), result (5), stderr (5), exception (5), timeout (5), concurrent (5), used (5), zoneoperationsclient (5), before (5), locations (5), explains (5), returned (5), confirm (5), signed (5), auth (5), discounts (5), monitoring (5), databases (5), accounts (5), errors (5), future (5), drivers (5), virtualization (5), nvidia (5), operations (5), placement (5), highly (5), multi (5), schedules (5), audit (5), symphony (5), email (5), scripts (5), manager (5), between (5), operating (5), systems (5), enhanced (5), capabilities (5), tenancy (5), restore (5), types (5), workstation (5), faq (5), flex (5), português (4), español (4), all (4), down (4), sample (4), its (4), troubleshooting (4), pacific (4), pst (4), alternatively (4), coordinated (4), universal (4), colons (4), year (4), hyphens (4), rfc (4), 3339 (4), timestamp (4), feature (4), subject (4), offerings (4), features (4), limited (4), launch (4), stage (4), descriptions (4), preview (4), fields (4), servicesharetype (4), sure (4), min_cpu_platform (4), scsi (4), model (4), accelerator_type (4), number_of_accelerators (4), optionally (4), ten (4), including (4), hours (4), size (4), accelerator (4), charges (4), consuming (4), series (4), instance_template_name (4), exists (4), shared_project_id (4), instance_properties (4), flush (4), warning (4), warnings (4), verbose_name (4), await (4), reservationresource (4), computelib (4), insertreservationrequest (4), instancetemplateuri (4), vmcount (4), createsharedreservation (4), static (4), public (4), constraint (4), nil (4), fmt (4), ctx (4), consumed (4), prevent (4), apis (4), authenticate (4), plan (4), cuds (4), tools (4), distributed (4), issues (4), ubuntu (4), bandwidth (4), tcp (4), pmu (4), upgrade (4), live (4), autoscaling (4), cross (4), calendar (4), metrics (4), health (4), active (4), clusters (4), containers (4), container (4), database (4), postgresql (4), extensions (4), work (4), suspend (4), resize (4), graceful (4), plans (4), replication (4), bound (4), otherwise (3), content (3), apache (3), next (3), platforms (3), instead (3), specified (3), ensure (3), fails (3), per (3), vcpus (3), block (3), project_map (3), share_settings (3), take (3), minute (3), finishes (3), option (3), deleting (3), useful (3), avoid (3), unnecessary (3), current (3), lists (3), add_box (3), exactly (3), outside (3), similar (3), those (3), note (3), url (3), exist (3), full (3), specifies (3), returns (3), args (3), creates (3), error_code (3), there (3), long (3), int (3), python (3), settings (3), todo (3), developer (3), once (3), ioexception (3), timeoutexception (3), executionexception (3), given (3), format (3), util (3), sourcetemplate (3), baseprojectid (3), writer (3), within (3), check (3), document (3), place (3), edit (3), orgpolicy (3), administrator (3), documentation (3), api (3), has (3), quota (3), commitment (3), committed (3), costs (3), utilization (3), guides (3), infrastructure (3), observability (3), analytics (3), automatic (3), encryption (3), pro (3), serial (3), patterns (3), higher (3), manual (3), scalable (3), resilient (3), autoscale (3), balancer (3), testing (3), ibm (3), spectrum (3), perform (3), deploying (3), prepare (3), deployment (3), rhel (3), protect (3), certificates (3), query (3), state (3), disable (3), increase (3), schedule (3), lifecycle (3), design (3), non (3), pool (3), move (3), workstations (3), tpus (3), product (3), 한국어 (2), 日本語 (2), עברית (2), brasil (2), italiano (2), indonesia (2), français (2), américa (2), latina (2), deutsch (2), english (2), site (2), youtube (2), center (2), started (2), system (2), pricing (2), products (2), last (2), updated (2), 2026 (2), licensed (2), under (2), feedback (2), 400 (2), 86400 (2), reservationsharingpolicy (2), reserving (2), mincpuplatform (2), supports (2), localssds (2), disksizegb (2), doesn (2), chosen (2), supported (2), guestaccelerators (2), share_type (2), days (2), 1d2h3m4s (2), 30m (2), min (2), number_of_local_ssd_disks (2), comma (2), doing (2), ready (2), shared_project (2), wait_for_extended_operation (2), source_instance_template (2), amount (2), def (2), error_message (2), runtimeerror (2), raise (2), raised (2), but (2), were (2), extendedoperation (2), callcreatecomputesharedreservation (2), split (2), consumer_project_id (2), customer (2), instancetemplatename (2), vmsnumber (2), variables (2), instantiate (2), timeunit (2), setzone (2), putprojectmap (2), needs (2), interruptedexception (2), throws (2), your_reservation_name (2), your_project_id (2), sharedreservationsownerprojects (2), main (2), unable (2), errorf (2), req (2), context (2), www (2), instancetemplate (2), template_name (2), path (2), volume (2), restrict (2), not (2), sections (2), admin (2), iam (2), provide (2), allowlist (2), until (2), viewing (2), restrictions (2), requirements (2), purchasing (2), exchange (2), purchase (2), improve (2), reduce (2), sdk (2), languages (2), frameworks (2), industry (2), solutions (2), hybrid (2), multicloud (2), pipelines (2), hosting (2), registration (2), sles (2), export (2), port (2), collecting (2), nodes (2), report (2), arm (2), core (2), rdp (2), app (2), latency (2), analyze (2), visible (2), cores (2), generation (2), underutilized (2), insights (2), globally (2), web (2), autohealing (2), iis (2), autoscaler (2), autoscalers (2), activity (2), kubernetes (2), directory (2), redis (2), cloning (2), always (2), alwayson (2), volumes (2), synchronization (2), switch (2), byol (2), payg (2), byos (2), changes (2), families (2), guide (2), securing (2), event (2), simulate (2), topology (2), together (2), repairs (2), repair (2), failures (2), suspended (2), stopped (2), distribution (2), physical (2), cancel (2), limit (2), interfaces (2), ipv6 (2), decrease (2), basic (2), consistent (2), scoped (2), copy (2), appliances (2), asynchronous (2), throughput (2), encrypt (2), names (2), mount (2), memory (2), extreme (2), balanced (2), through (2), advanced (2), rdma (2), preemptible (2), provisioning (2), models (2), rtx (2), vws (2), constraints (2), technology (2), areas (2), close (2), subscribe, newsletter, our, third, decade, climate, action, join, cookies, privacy, tech, twitter, blog, engage, certification, architecture, getting, github, release, notes, community, forums, contact, sales, marketplace, easy, easytounderstand, solved, problem, solvedmyproblem, otherup, hard, hardtounderstand, incorrect, incorrectinformationorsamplecode, missing, missingtheinformationsamplesineed, otherdown, tell, except, noted, registered, trademark, oracle, affiliates, developers, creative, commons, attribution, what, deletes, acceleratorcount, acceleratortype, google_compute_reservation, ensuring, changing, newly, both, overriding, 123456789012, iter, reservation_resource, partial, exclude, allocated, specific_reservation, disk_size_gb, allocationspecificskuallocationallocatedinstancepropertiesreserveddisk, local_ssds, allocationspecificskuallocationreservedinstanceproperties, object, represents, gcp, create_compute_shared_reservation, message, futures, timeouterror, case, taking, longer, than, received, raises, whatever, none, indefinitely, finish, reporting, verbose, they, printed, execution, ends, successful, waits, extended, 300, api_core, extended_operation, typing, annotations, __future__, log, pop, done, latestresponse, function, async, getprojectid, uncomment, protos, library, getstatus, failed, throw, haserror, insertasync, setreservationresource, setproject, setsourceinstancetemplate, setcount, setspecificreservation, setsharesettings, setspecificreservationrequired, setname, consumer_project_2, consumer_project_1, valueof, setsharetype, try, reused, your_instance_template_name, uri, docs, shared_reservation_constraint, visit, them, void, class, fprintf, int64, map, background, formats, west3, your_project_id2, destination, newreservationsrestclient, clientinterface, func, particular, golang, org, protobuf, apiv1, such, bind, look, references, inside, contains, explained, requires, mismatched, however, because, recommended, modified, also, able, usereadonly, contain, exact, expand, granting, folders, organizations, policyadmin, ask, grant, haven, verifies, selecting, installed, previously, latest, version, components, init, installation, tab, been, added, empty, grants, permission, editing, begin, incurs, even, being, billing, known, level, spending, hardware, pages, hosts, save, categorize, preferences, stay, organized, collections, home, renewal, resizing, common, pay, output, diagnostic, sudoers, screenshots, generate, bug, blackwell, soft, lockups, bus, locks, rescue, inaccessible, dumps, kernel, panic, fstab, unresponsive, suspension, reboots, shutdowns, connectivity, tips, nics, dpdk, resiliency, communication, compact, idpf, irdma, driver, nic, customize, threads, sustained, merge, extend, renew, cost, savings, dynamic, overcommit, cpus, floating, reliable, udp, backends, routing, scaling, combine, cud, decisions, signals, serving, predictions, organize, labels, replica, states, observe, reports, tensorflow, inference, tensorrt5, learning, monte, carlo, spark, forwarding, others, integrate, clustering, 2016, sharepoint, strategies, passive, inactive, setups, built, integrations, validation, deployed, transition, test, hammerdb, bucket, aws, ec2, pacemaker, s2d, netapp, hot, standby, drbd, architectures, private, address, mailjet, mailgun, sendgrid, sending, blue, green, deployments, lamp, joomla, asp, net, interactive, mongodb, flask, servers, over, mtls, random, generator, virtio, rng, accurate, protocol, ntp, append, els, packages, deprecate, versions, family, trusted, red, hat, knowledgebase, functionality, risks, vpc, controls, confidential, kek, secure, expiration, shielded, attributes, handle, notices, process, faulty, unmanaged, affect, preserved, turn, off, alternate, repairing, maintain, upgrades, override, selectively, applying, accelerate, out, outage, rebalance, reenable, proactive, redistribution, shape, distribute, info, accidental, deletion, spread, rename, reset, resume, restart, referrers, uuid, recover, corrupted, duplicate, clones, alerts, backups, vss, regionally, different, protection, considerations, synchronous, consistency, failback, replicate, provisioned, iops, limits, evaluate, help, kms, supplied, symbolic, links, practice, device, ram, additional, exapools, ptr, record, failure, rates, tags, automate, password, powershell, sac, securely, apps, root, vpn, bastion, iap, connection, browser, connections, networks, iso, imported, prerequisites, importing, exporting, bring, own, detach, reattach, accounting, provision, examples, slurm, team, slice, slices, adds, scenarios, deterministic, base, aci, configured, preempted, historical, alternative, displays, ops, logging, subnet, gpudirect, enabled, ultra, hostname, quickstarts, office, licensing, premium, strategy, gemini, bare, metal, accelerators, scores, purpose, discover, free, skip,
Text of the page (random words):
servation by using the properties of an existing vm you can consume the reservation by creating vms with properties that match the reference vm specify properties directly this section explains how to directly define the properties of a shared reservation this method requires you to manually ensure that the properties of your vms and reservations match exactly any mismatched properties prevent consumption by default a reservation can be automatically consumed by any vms with properties that match it if you want to control reservation consumption do one or more of the following create a reservation that can only be consumed by vms that specifically target it as explained in the following sections in this document then configure vms to consume that specific reservation configure vms to not consume reservations specify an instance template before creating a reservation by specifying an instance template make sure of the following an instance template contains project specific settings so you can only access and use an instance template within the same project if you create a shared reservation by specifying an instance template then you can t use the same template to create vms that can consume the reservation outside of the project that created the reservation create your reservation in the same region and zone as the resources within the instance template any regional or zonal resources specified in an instance template such as a machine type or a persistent disk volume restrict the use of the template to the locations where those resources exist for example if your instance template specifies an existing persistent disk volume in zone us central1 a then you can only create your reservation in the same zone to check if an existing template specifies any resources that bind the template to a specific region or zone view the details of the instance template and look for references to regional or zonal resources inside of it to create a shared reservation by specifying an instance template select one of the following options console in the google cloud console go to the reservations page go to reservations click add_box create reservation the create a reservation page appears in the name field enter a name for your reservation in the region and zone lists select where you want to reserve resources in the share type section do the following to share a reservation with other projects select shared click add add projects and then select the projects from the current project s organization that you want to share the reservation with you can select up to 100 consumer projects optional to let custom training jobs or prediction jobs in vertex ai consume a reservation of gpu vms in the google cloud services section select share reservation in the use with vm instance section select one of the following options to allow matching vms to automatically consume this reservation select use reservation automatically to consume this reservation s resources only when you create matching vms that specifically target the reservation by name select select specific reservation in the resource details section do the following in the number of vm instances field enter the number of vms that you want to reserve to specify vm configurations by using an instance template select use instance template and then in the list that appears select the instance template in the auto delete section you can enable the auto delete option to let compute engine automatically delete the reservation at a specific date and time automatically deleting reservations can be useful to avoid unnecessary charges when you stop consuming the reservation to create the reservation click create the reservations page appears creating the reservation can take up to a minute to complete to verify when compute engine finishes creating it view your reservations gcloud to create a shared reservation use the gcloud compute reservations create command with the share setting projects and share with flags to create a shared reservation by specifying an instance template and without including any optional flags run the following command gcloud compute reservations create reservation_name share setting projects share with consumer_project_ids source instance template instance_template_url vm count number_of_vms zone zone replace the following reservation_name the name of the reservation to create project_id the id of the project where you want to reserve resources and where the instance template exists consumer_project_ids a comma separated list of ids of projects that can consume this reservation for example project 1 project 2 you can include up to 100 consumer projects these projects must be in the same organization as the owner project don t include the owner project by default it s already allowed to consume the reservation instance_template_url the url of an existing instance template which must exist in your project specify one of the following values for a regional instance template projects project_id regions region instancetemplates instance_template_name for a global instance template instance_template_name number_of_vms the number of vms to reserve zone the zone in which to reserve resources for example to create a reservation by specifying a global instance template in zone us central1 a share the reservation with projects project 1 and project 2 and reserve ten vms that each use an n2 predefined machine type with 4 vcpus run the following command gcloud compute reservations create my reservation share setting projects share with project 1 project 2 source instance template projects example project global example instance template vm count 10 zone us central1 a optionally you can do one or more of the following to specify that only vms that specifically target this reservation can consume it include the require specific reservation flag gcloud compute reservations create reservation_name require specific reservation share setting projects share with consumer_project_ids source instance template instance_template_url vm count number_of_vms zone zone to let custom training jobs or prediction jobs in vertex ai consume a reservation of gpu vms include the reservation sharing policy flag set to allow_all gcloud compute reservations create reservation_name reservation sharing policy allow_all share setting projects share with consumer_project_ids source instance template instance_template_url vm count number_of_vms zone zone to enable compute engine to automatically delete the reservation select one of the following methods preview the delete at time and delete after duration flags this feature is subject to the pre ga offerings terms in the general service terms section of the service specific terms pre ga features are available as is and might have limited support for more information see the launch stage descriptions to delete the reservation at a specific date and time use the gcloud beta compute reservations create command with the delete at time flag gcloud beta compute reservations create reservation_name delete at time delete_at_time share setting projects share with consumer_project_ids source instance template instance_template_url vm count number_of_vms zone zone replace delete_at_time with a date and time formatted as an rfc 3339 timestamp which must be as follows yyyy mm dd t hh mm ss offset replace the following yyyy mm dd a date formatted as a 4 digit year 2 digit month and a 2 digit day of the month separated by hyphens hh mm ss a time formatted as a 2 digit hour using a 24 hour time 2 digit minutes and 2 digit seconds separated by colons offset the time zone formatted as an offset of coordinated universal time utc for example to use the pacific standard time pst specify 08 00 alternatively to use no offset specify z to delete the reservation after a specific duration use the gcloud beta compute reservations create command with the delete after duration flag gcloud beta compute reservations create reservation_name delete after duration delete_after_duration share setting projects share with consumer_project_ids source instance template instance_template_url vm count number_of_vms zone zone replace delete_after_duration with a duration in days hours minutes or seconds for example specify 30m for 30 minutes or 1d2h3m4s for 1 day 2 hours 3 minutes and 4 seconds go import context fmt io computepb cloud google com go compute apiv1 computepb google golang org protobuf proto creates shared reservation from given template in particular zone func createsharedreservation w io writer client clientinterface projectid baseprojectid zone reservationname sourcetemplate string error client err compute newreservationsrestclient ctx projectid your_project_id destination of sharing baseprojectid your_project_id2 project where the reservation will be created zone us west3 a reservationname your_reservation_name sourcetemplate existing template path following formats are allowed projects project_id global instancetemplates template_name projects project_id regions region instancetemplates template_name https www googleapis com compute v1 projects project_id global instancetemplates instancetemplate https www googleapis com compute v1 projects project_id regions region instancetemplates instancetemplate ctx context background sharesettings map string computepb sharesettingsprojectconfig projectid projectid proto string projectid req computepb insertreservationrequest project baseprojectid reservationresource computepb reservation name proto string reservationname zone proto string zone specificreservation computepb allocationspecificskureservation count proto int64 2 sourceinstancetemplate proto string sourcetemplate sharesettings computepb sharesettings projectmap sharesettings sharetype proto string specific_projects zone zone op err client insert ctx req if err nil return fmt errorf unable to create reservation w err if op nil if err op wait ctx err nil return fmt errorf unable to wait for the operation w err fmt fprintf w reservation created n return nil java import com google cloud compute v1 allocationspecificskureservation import com google cloud compute v1 insertreservationrequest import com google cloud compute v1 operation import com google cloud compute v1 operation status import com google cloud compute v1 reservation import com google cloud compute v1 reservationsclient import com google cloud compute v1 sharesettings import com google cloud compute v1 sharesettingsprojectconfig import java io ioexception import java util concurrent executionexception import java util concurrent timeunit import java util concurrent timeoutexception public class createsharedreservation public static void main string args throws ioexception executionexception interruptedexception timeoutexception todo developer replace these variables before running the sample the id of the project where you want to reserve resources and where the instance template exists by default no projects are allowed to create or modify shared reservations in an organization add projects to the shared reservations owner projects compute sharedreservationsownerprojects organization policy constraint to allow them to create and modify shared reservations for more information visit this page https cloud google com compute docs instances reservations shared shared_reservation_constraint string projectid your_project_id zone in which to reserve resources string zone us central1 a name of the reservation to be created string reservationname your_reservation_name the uri of the global instance template to be used for creating the reservation string instancetemplateuri string format projects s global instancetemplates s projectid your_instance_template_name number of instances for which capacity needs to be reserved int vmcount 3 createsharedreservation projectid zone reservationname instancetemplateuri vmcount creates a shared reservation with the given name in the given zone public static status createsharedreservation string projectid string zone string reservationname string instancetemplateuri int vmcount throws executionexception interruptedexception timeoutexception ioexception initialize client that will be used to send requests this client only needs to be created once and can be reused for multiple requests try reservationsclient reservationsclient reservationsclient create sharesettings sharesettings sharesettings newbuilder setsharetype string valueof sharesettings sharetype specific_projects the ids of projects that can consume this reservation you can include up to 100 consumer projects these projects must be in the same organization as the owner project don t include the owner project by default it is already allowed to consume the reservation putprojectmap consumer_project_1 sharesettingsprojectconfig newbuilder build putprojectmap consumer_project_2 sharesettingsprojectconfig newbuilder build build reservation reservationresource reservation newbuilder setname reservationname setzone zone setspecificreservationrequired true setsharesettings sharesettings setspecificreservation allocationspecificskureservation newbuilder setcount vmcount setsourceinstancetemplate instancetemplateuri build build insertreservationrequest request insertreservationrequest newbuilder setproject projectid setzone zone setreservationresource reservationresource build operation response reservationsclient insertasync request get 3 timeunit minutes if response haserror throw new error reservation creation failed response return response getstatus node js import the compute library const computelib require google cloud compute const compute computelib protos google cloud compute v1 todo developer uncomment reservationsclient and zoneoperationsclient before running the sample instantiate a reservationsclient reservationsclient new computelib reservationsclient instantiate a zoneoperationsclient zoneoperationsclient new computelib zoneoperationsclient todo developer update these variables before running the sample the id of the project where you want to reserve resources and where the instance template exists const projectid await reservationsclient getprojectid the zone in which to reserve resources const zone us central1 a the name of the reservation to create const reservationname reservation 01 the number of vms to reserve const vmsnumber 3 the name of an existing instance template const instancetemplatename global instance template name the location of the instance template const location global async function callcreatecomputesharedreservation create reservation for 3 vms in zone us central1 a by specifying a instance template const specificreservation new compute allocationspecificskureservation count vmsnumber sourceinstancetemplate projects projectid location instancetemplates instancetemplatename create share settings share reservation with one customer project const sharesettings new compute sharesettings sharetype specific...
|