Meta tags:
description= Create reservations of Compute Engine VM instances for a single project.;
Headings (most frequently used words):
console, gcloud, rest, specify, create, reservation, single, project, and, terraform, required, an, go, java, node, js, python, for, 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 (515), #reservation (257), create (234), for (171), and (168), vms (167), compute (137), zone (134), with (118), #instance (108), you (100), reservations (90), that (82), use (80), operation (73), cloud (70), google (69), template (69), name (65), troubleshoot (63), about (62), following (61), project (57), disk (57), using (55), specify (51), set (51), machine (51), policy (50), resources (49), manage (47), delete (47), time (46), disks (46), view (45), can (45), type (45), placement (44), this (43), count (42), import (41), reservation_name (40), server (39), your (38), com (37), projects (37), project_id (36), select (36), engine (35), gcloud (35), want (34), mig (34), configure (34), specific (33), request (33), local (33), from (33), string (33), windows (33), number_of_vms (32), reserve (32), gpu (31), compact (31), instances (31), overview (31), number (30), reservationsclient (30), performance (30), single (29), existing (29), consume (28), field (28), region (28), replace (27), one (27), properties (27), post (26), zones (26), only (26), creating (26), cpu (26), digit (24), ssd (24), const (24), https (23), machine_type (23), projectid (23), more (22), specificreservation (22), include (22), section (22), custom (22), network (22), reservationname (22), policies (21), monitor (21), new (21), hyperdisk (21), sql (21), seconds (20), example (20), googleapis (20), make (20), central1 (20), access (20), images (20), automatically (19), true (19), regional (19), where (18), resource (18), return (18), err (18), image (18), creation (17), platform (17), default (17), based (17), linux (17), see (16), beta (16), formatted (16), offset (16), service (16), available (16), when (16), reserved (16), interface (16), gpus (16), any (16), optional (16), attached (16), virtual (16), terms (15), how (15), machinetype (15), date (15), which (15), regions (15), compute_v1 (15), global (15), instancetemplates (15), proto (15), group (15), snapshots (15), groups (15), ssh (15), recommendations (15), configuration (15), are (14), duration (14), after (14), standard (14), enable (14), jobs (14), target (14), each (14), add (14), wait (14), update (14), persistent (14), workload (14), host (14), load (14), apply (14), connect (14), page (13), method (13), running (13), console (13), build (13), computepb (13), flag (13), click (13), location (13), management (13), bulk (13), microsoft (13), cluster (13), information (12), instanceproperties (12), insert (12), minutes (12), specificreservationrequired (12), specifically (12), 375 (12), get (12), sys (12), will (12), multiple (12), command (12), then (12), instance_template_url (12), install (12), storage (12), sole (12), availability (12), best (12), java (11), attach (11), must (11), minimum (11), nvme (11), specifying (11), let (11), print (11), during (11), complete (11), run (11), options (11), zonal (11), machines (11), authentication (11), cli (11), application (11), practices (11), workloads (11), stateful (11), code (10), commitments (10), body (10), have (10), specifies (10), allocationspecificskureservation (10), str (10), result (10), stderr (10), file (10), exception (10), timeout (10), appears (10), managed (10), identity (10), metadata (10), migs (10), migrate (10), logs (10), samples (9), details (9), response (9), client (9), nvidia (9), error (9), concurrent (9), used (9), created (9), require (9), login (9), licenses (9), tenant (9), openshift (9), shutdown (9), start (9), hpc (9), training (8), support (8), license (8), send (8), day (8), delete_after_duration (8), hour (8), separated (8), month (8), yyyy (8), delete_at_time (8), pre (8), allow_all (8), errors (8), sure (8), specific_reservation (8), flush (8), warning (8), warnings (8), verbose_name (8), int (8), await (8), zoneoperationsclient (8), computelib (8), newbuilder (8), numberofvms (8), requests (8), nil (8), fmt (8), ctx (8), stop (8), enter (8), reference (8), sourceinstancetemplate (8), manually (8), permissions (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), thumb (7), might (7), vertex (7), prediction (7), scsi (7), predefined (7), terraform (7), node (7), public (7), list (7), share (7), services (7), source (7), environment (7), demand (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), templates (7), snapshot (7), backup (7), events (6), status (6), other (6), sample (6), utc (6), otherwise (6), learn (6), deleteafterduration (6), follows (6), deleteattime (6), general (6), methods (6), allow (6), supported (6), avoid (6), mincpuplatform (6), instead (6), model (6), directly (6), without (6), instance_properties (6), allocationspecificskuallocationallocatedinstancepropertiesreserveddisk (6), returns (6), args (6), error_code (6), there (6), long (6), uncomment (6), todo (6), developer (6), before (6), timeoutexception (6), executionexception (6), ioexception (6), static (6), flags (6), your_project_id (6), util (6), auto (6), matching (6), match (6), same (6), control (6), roles (6), required (6), development (6), external (6), provider (6), credentials (6), usage (6), security (6), migration (6), data (6), updates (6), instant (6), files (6), nested (6), across (6), applications (6), mode (6), pools (6), failover (6), extension (6), change (6), transfer (6), customized (6), spot (6), sign (5), understand (5), need (5), consumption (5), consumed (5), within (5), latency (5), min_cpu_platform (5), values (5), interface_type (5), localssds (5), accelerator_type (5), guestaccelerators (5), acceleratortype (5), including (5), rest (5), creates (5), these (5), size (5), accelerator (5), close (5), sharing (5), maximum (5), take (5), configurations (5), uses (5), instancetemplateuri (5), locations (5), define (5), review (5), discounts (5), monitoring (5), databases (5), accounts (5), future (5), drivers (5), virtualization (5), operations (5), highly (5), multi (5), modify (5), capacity (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), 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), servicesharetype (4), compact_placement_policy_name (4), located (4), disksizegb (4), ensure (4), chosen (4), fails (4), per (4), number_of_accelerators (4), optionally (4), ten (4), vcpus (4), wait_for_extended_operation (4), tesla (4), acceleratorconfig (4), intel (4), allocationspecificskuallocationreservedinstanceproperties (4), def (4), error_message (4), runtimeerror (4), raise (4), raised (4), were (4), extendedoperation (4), reservationresource (4), interfaces (4), vmsnumber (4), variables (4), instantiate (4), timeunit (4), once (4), initialize (4), interruptedexception (4), throws (4), createreservation (4), your_reservation_name (4), unable (4), errorf (4), req (4), context (4), writer (4), apiv1 (4), hours (4), verify (4), charges (4), consuming (4), distance (4), value (4), requirements (4), series (4), instance_template_name (4), www (4), instancetemplate (4), template_name (4), explains (4), prevent (4), apis (4), authenticate (4), idp (4), federated (4), user (4), account (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), content (3), its (3), apache (3), fields (3), additionally (3), resourcepolicies (3), reduce (3), platforms (3), specified (3), supports (3), acceleratorcount (3), disk_size_gb (3), source_instance_template (3), full (3), url (3), case (3), but (3), none (3), they (3), split (3), while (3), skylake (3), localssdsize (3), main (3), min (3), int64 (3), insertreservationrequest (3), minute (3), finishes (3), option (3), deleting (3), useful (3), unnecessary (3), lists (3), add_box (3), exactly (3), reservations_client (3), path (3), instancetemplatename (3), createreservationforinstancetemplate (3), check (3), document (3), place (3), documentation (3), first (3), api (3), don (3), commitment (3), committed (3), costs (3), shared (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), next (2), 400 (2), 86400 (2), reservationsharingpolicy (2), indicates (2), among (2), reserving (2), doesn (2), false (2), specific_reservation_required (2), omit (2), share_type (2), share_settings (2), block (2), google_compute_reservation (2), local_ssds (2), ready (2), reservation_resource (2), allocated (2), amount (2), object (2), represents (2), message (2), futures (2), timeouterror (2), taking (2), longer (2), than (2), received (2), raises (2), whatever (2), indefinitely (2), finish (2), reporting (2), verbose (2), printed (2), execution (2), ends (2), successful (2), waits (2), extended (2), 300 (2), api_core (2), extended_operation (2), typing (2), annotations (2), __future__ (2), python (2), callcreatecomputereservationfromproperties (2), log (2), pop (2), done (2), latestresponse (2), needed (2), function (2), async (2), getprojectid (2), protos (2), library (2), null (2), haserror (2), insertasync (2), localssdinterface2 (2), setinterface (2), setdisksizegb (2), addlocalssds (2), localssdinterface1 (2), numberofaccelerators (2), setcount (2), setspecificreservation (2), setzone (2), setname (2), try (2), reused (2), needs (2), accelerators (2), void (2), class (2), fprintf (2), read (2), docs (2), defer (2), newreservationsrestclient (2), background (2), west3 (2), func (2), golang (2), org (2), protobuf (2), days (2), 1d2h3m4s (2), 30m (2), number_of_local_ssd_disks (2), few (2), pane (2), unspecified (2), separately (2), important (2), meets (2), doing (2), exists (2), formats (2), allowed (2), callcreatecomputereservationinstancetemplate (2), slice (2), your_instance_template_name (2), uri (2), sourcetemplate (2), volume (2), restrict (2), not (2), sections (2), role (2), iam (2), admin (2), provide (2), shell (2), note (2), restrictions (2), purchasing (2), exchange (2), purchase (2), sdk (2), languages (2), frameworks (2), industry (2), solutions (2), hybrid (2), multicloud (2), pipelines (2), hosting (2), quota (2), registration (2), sles (2), export (2), port (2), collecting (2), nodes (2), report (2), arm (2), core (2), rdp (2), app (2), analyze (2), visible (2), cores (2), generation (2), underutilized (2), insights (2), utilization (2), globally (2), web (2), autohealing (2), iis (2), autoscaler (2), autoscalers (2), activity (2), kubernetes (2), directory (2), setting (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), ipv6 (2), decrease (2), basic (2), consistent (2), scoped (2), copy (2), appliances (2), asynchronous (2), throughput (2), encrypt (2), names (2), format (2), mount (2), memory (2), extreme (2), balanced (2), organization (2), through (2), advanced (2), rdma (2), preemptible (2), provisioning (2), models (2), rtx (2), vws (2), constraints (2), technology (2), areas (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, two, affinity, gce, partial, exclude, accelerator_count, guest_accelerators, ivy, bridge, gcp, create_compute_reservation, setacceleratortype, setacceleratorcount, addguestaccelerators, setmincpuplatform, setmachinetype, setinstanceproperties, setspecificreservationrequired, boolean, int32, attaching, allows, customising, direct, createbasereservation, accelerated, lower, ensuring, newly, both, overriding, create_reservation_from_template, variable, depending, pernament, setsourceinstancetemplate, given, particular, such, those, exist, bind, look, references, inside, possible, explained, requires, mismatched, recommended, also, able, usereadonly, contains, exact, expand, ask, administrator, grant, granting, folders, organizations, haven, already, verifies, selecting, returned, confirm, signed, auth, installed, previously, latest, version, components, init, installation, tab, begin, charged, even, until, still, incur, billing, known, level, spending, hardware, pages, save, categorize, preferences, stay, organized, collections, home, renewal, resizing, common, pay, viewing, 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, improve, resiliency, communication, 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, edit, 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, settings, help, kms, customer, 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, constraint, accounting, provision, examples, slurm, team, slices, adds, scenarios, deterministic, base, aci, configured, preempted, historical, alternative, similar, displays, ops, logging, subnet, has, gpudirect, enabled, ultra, hostname, quickstarts, office, licensing, premium, strategy, gemini, bare, metal, scores, purpose, discover, free, skip,
Text of the page (random words):
icy click create creating the compact placement policy might take a few seconds to complete otherwise select an existing compact placement policy 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 single project reservation use the gcloud compute reservations create command to create a single project reservation by specifying properties directly and without including any optional flags run the following command gcloud compute reservations create reservation_name machine type machine_type vm count number_of_vms zone zone replace the following reservation_name the name of the reservation to create machine_type a machine type to use for each vm number_of_vms the number of vms to reserve zone the zone in which to reserve resources for example to create a reservation in zone us central1 a for ten vms that each use an n2 predefined machine type with 4 vcpus run the following command gcloud compute reservations create my reservation machine type n2 standard 4 vm count 10 zone us central1 a optionally you can do one or more of the following to attach gpus to your reserved n1 vms include the accelerator flag gcloud compute reservations create reservation_name accelerator count number_of_accelerators type accelerator_type machine type machine_type vm count number_of_vms zone zone replace the following number_of_accelerators the number of gpus to add per reserved vm accelerator_type a supported gpu model for n1 vms ensure that your chosen gpu model is available in the zone where you want to reserve resources otherwise creating the reservation fails to attach local ssd disks to a machine type that doesn t include local ssd disks by default include the local ssd flag you can only attach local ssd disks of 375 gb gcloud compute reservations create reservation_name local ssd count number_of_local_ssd_disks size 375 interface interface_type machine type machine_type vm count number_of_vms zone zone replace the following number_of_local_ssd_disks the number of local ssd disks to attach interface_type the type of disk interface that you want each local ssd disk to use and that your specified machine type supports specify one of the following values for the nvme disk interface nvme for the scsi disk interface scsi to have the reserved vms use a specific minimum cpu platform instead of the zone s default cpu platform include the min cpu platform flag gcloud compute reservations create reservation_name machine type machine_type min cpu platform min_cpu_platform vm count number_of_vms zone zone replace min_cpu_platform with a minimum cpu platform to make sure that a cpu platform is available in the zone where you re reserving resources view the available cpu platforms by zone 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 machine type machine_type require specific reservation vm count number_of_vms zone zone to specify a compact placement policy for lower network latency among vms include the resource policies policy flag gcloud compute reservations create reservation_name machine type machine_type resource policies policy compact_placement_policy_name require specific reservation vm count number_of_vms zone zone replace compact_placement_policy_name with the name of an existing compact placement policy additionally to avoid errors when creating a single project reservation that specifies a compact placement policy make sure to specify the following a supported machine type and maximum number of vms for compact placement policies a zone within the region where the compact placement policy is located the require specific reservation flag this indicates that only vms that specifically target the reservation can consume it 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 machine type machine_type reservation sharing policy allow_all 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 machine type machine_type 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 machine type machine_type 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 compute cloud google com go compute apiv1 computepb cloud google com go compute apiv1 computepb google golang org protobuf proto creates the reservation with accelerated image func createbasereservation w io writer projectid zone reservationname string error projectid your_project_id zone us west3 a reservationname your_reservation_name ctx context background reservationsclient err compute newreservationsrestclient ctx if err nil return err defer reservationsclient close creating reservation based on direct properties req computepb insertreservationrequest project projectid reservationresource computepb reservation name proto string reservationname zone proto string zone specificreservation computepb allocationspecificskureservation count proto int64 2 properties which allows customising instances instanceproperties computepb allocationspecificskuallocationreservedinstanceproperties attaching gpus to the reserved vms read more https cloud google com compute docs gpus n1 gpus guestaccelerators computepb acceleratorconfig acceleratorcount proto int32 1 acceleratortype proto string nvidia tesla t4 including local ssd disks localssds computepb allocationspecificskuallocationallocatedinstancepropertiesreserveddisk disksizegb proto int64 375 interface proto string nvme machinetype proto string n1 standard 2 specifying minimum cpu platform read more https cloud google com compute docs instances specify min cpu platform mincpuplatform proto string intel skylake zone zone op err reservationsclient insert ctx req if err nil return fmt errorf unable to create reservation w err 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 acceleratorconfig import com google cloud compute v1 allocationspecificskuallocationallocatedinstancepropertiesreserveddisk import com google cloud compute v1 allocationspecificskuallocationreservedinstanceproperties import com google cloud compute v1 allocationspecificskureservation import com google cloud compute v1 operation import com google cloud compute v1 reservation import com google cloud compute v1 reservationsclient import java io ioexception import java util concurrent executionexception import java util concurrent timeunit import java util concurrent timeoutexception public class createreservation public static void main string args throws ioexception executionexception interruptedexception timeoutexception todo developer replace these variables before running the sample project id or project number of the cloud project you want to use string projectid your_project_id name of the zone in which you want to create the disk string zone us central1 a name of the reservation you want to create string reservationname your_reservation_name number of instances in the reservation int numberofvms 3 createreservation projectid reservationname numberofvms zone creates reservation with optional flags public static reservation createreservation string projectid string reservationname int numberofvms string zone throws ioexception executionexception interruptedexception timeoutexception create the reservation with optional properties machine type of the instances in the reservation string machinetype n1 standard 2 number of accelerators to be attached to the instances in the reservation int numberofaccelerators 1 accelerator type to be attached to the instances in the reservation string acceleratortype nvidia tesla t4 minimum cpu platform to be attached to the instances in the reservation string mincpuplatform intel skylake local ssd size in gb to be attached to the instances in the reservation int localssdsize 375 local ssd interfaces to be attached to the instances in the reservation string localssdinterface1 nvme string localssdinterface2 scsi boolean specificreservationrequired true 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 reservation reservation reservation newbuilder setname reservationname setzone zone setspecificreservationrequired specificreservationrequired setspecificreservation allocationspecificskureservation newbuilder set the number of instances setcount numberofvms set instance properties setinstanceproperties allocationspecificskuallocationreservedinstanceproperties newbuilder setmachinetype machinetype setmincpuplatform mincpuplatform addguestaccelerators acceleratorconfig newbuilder setacceleratorcount numberofaccelerators setacceleratortype acceleratortype build addlocalssds allocationspecificskuallocationallocatedinstancepropertiesreserveddisk newbuilder setdisksizegb localssdsize setinterface localssdinterface1 build addlocalssds allocationspecificskuallocationallocatedinstancepropertiesreserveddisk newbuilder setdisksizegb localssdsize setinterface localssdinterface2 build build build build operation response reservationsclient insertasync projectid zone reservation get 7 timeunit minutes if response haserror return null return reservationsclient get projectid zone reservationname node js import the compute library const computelib require google cloud compute const compute computelib protos google cloud compute v1 instantiate a reservationsclient const reservationsclient new computelib reservationsclient instantiate a zoneoperationsclient const zoneoperationsclient new computelib zoneoperationsclient todo developer update uncomment these variables before running the sample the id of the project where you want to reserve resources const projectid await reservationsclient getprojectid the zone in which to reserve resources const zone us central1 a the name of the reservation to create reservationname reservation 01 the number of vms to reserve const vmsnumber 3 machine type to use for each vm const machinetype n1 standard 4 async function callcreatecomputereservationfromproperties create specific reservation for 3 vms that each use an n1 predefined machine type with 4 vcpus const specificreservation new compute allocationspecificskureservation count vmsnumber instanceproperties machinetype to have the reserved vms use a specific minimum cpu platform instead of the zone s default cpu platform mincpuplatform intel skylake if you want to attach gpus to your reserved n1 vms update and uncomment guestaccelerators if needed guestaccelerators the number of gpus to add per reserved vm acceleratorcount 1 supported gpu model for n1 vms ensure that your chosen gpu model is available in the zone where you want to reserve resources acceleratortype nvidia tesla t4 if you want to add local ssd disks to each reserved vm update and uncomment localssds if needed you can specify up to 24 local ssd disks each local ssd disk is 375 gb localssds disksizegb 375 the type of interface you want each local ssd disk to use specify one of the following values nvme or scsi make sure that the machine type you specify for the reserved vms supports the chosen disk interfaces interface nvme create a reservation const reservation new compute reservation name reservationname zone specificreservation to specify that only vms that specifically target this reservation can consume it set specificreservationrequired field to true specificreservationrequired true const response await reservationsclient insert project projectid reservationresource reservation zone let operation response latestresponse wait for the create reservation operation to complete while operation status done operation await zoneoperationsclient wait operation operation name project projectid zone operation zone split pop console log reservation reservationname created await callcreatecomputereservationfromproperties python from __future__ import annotations import sys from typing import any from google api_core extended_operation import extendedoperation from google cloud import compute_v1 def wait_for_extended_operation operation extendedoperation verbose_name str operation timeout int 300 any waits for the extended long running operation to complete if the operation is successful it will return its result if the operation ends with an error an exception will be raised if there were any warnings during the execution of the operation they will be printed to sys stderr args operation a long running operation you want to wait on verbose_name optional a more verbose name of the operation used only during error and warning reporting timeout how long in seconds to wait for operation to finish if none wait indefinitely returns whatever the operation result returns raises this method will raise the ...
|