CINXE.COM

Create a VM with a custom machine type  |  Compute Engine Documentation  |  Google Cloud

<!doctype html> <html lang="en" dir="ltr"> <head> <meta name="google-signin-client-id" content="721724668570-nbkv1cfusk7kk4eni4pjvepaus73b13t.apps.googleusercontent.com"> <meta name="google-signin-scope" content="profile email https://www.googleapis.com/auth/developerprofiles https://www.googleapis.com/auth/developerprofiles.award https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/webhistory"> <meta property="og:site_name" content="Google Cloud"> <meta property="og:type" content="website"><meta name="theme-color" content="#039be5"><meta charset="utf-8"> <meta content="IE=Edge" http-equiv="X-UA-Compatible"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="manifest" href="/_pwa/cloud/manifest.json" crossorigin="use-credentials"> <link rel="preconnect" href="//www.gstatic.com" crossorigin> <link rel="preconnect" href="//fonts.gstatic.com" crossorigin> <link rel="preconnect" href="//fonts.googleapis.com" crossorigin> <link rel="preconnect" href="//apis.google.com" crossorigin> <link rel="preconnect" href="//www.google-analytics.com" crossorigin><link rel="stylesheet" href="//fonts.googleapis.com/css?family=Google+Sans:400,500,700|Google+Sans+Text:400,400italic,500,500italic,700,700italic|Roboto:400,400italic,500,500italic,700,700italic|Roboto+Mono:400,500,700&display=swap"> <link rel="stylesheet" href="//fonts.googleapis.com/css2?family=Material+Icons&family=Material+Symbols+Outlined&display=block"><link rel="stylesheet" href="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/css/app.css"> <link rel="shortcut icon" href="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/images/favicons/onecloud/favicon.ico"> <link rel="apple-touch-icon" href="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/images/favicons/onecloud/super_cloud.png"><link rel="canonical" href="https://cloud.google.com/compute/docs/instances/creating-instance-with-custom-machine-type"><link rel="search" type="application/opensearchdescription+xml" title="Google Cloud" href="https://cloud.google.com/s/opensearch.xml"> <link rel="alternate" hreflang="en" href="https://cloud.google.com/compute/docs/instances/creating-instance-with-custom-machine-type" /><link rel="alternate" hreflang="x-default" href="https://cloud.google.com/compute/docs/instances/creating-instance-with-custom-machine-type" /><link rel="alternate" hreflang="zh-Hans" href="https://cloud.google.com/compute/docs/instances/creating-instance-with-custom-machine-type?hl=zh-cn" /><link rel="alternate" hreflang="fr" href="https://cloud.google.com/compute/docs/instances/creating-instance-with-custom-machine-type?hl=fr" /><link rel="alternate" hreflang="de" href="https://cloud.google.com/compute/docs/instances/creating-instance-with-custom-machine-type?hl=de" /><link rel="alternate" hreflang="id" href="https://cloud.google.com/compute/docs/instances/creating-instance-with-custom-machine-type?hl=id" /><link rel="alternate" hreflang="it" href="https://cloud.google.com/compute/docs/instances/creating-instance-with-custom-machine-type?hl=it" /><link rel="alternate" hreflang="ja" href="https://cloud.google.com/compute/docs/instances/creating-instance-with-custom-machine-type?hl=ja" /><link rel="alternate" hreflang="ko" href="https://cloud.google.com/compute/docs/instances/creating-instance-with-custom-machine-type?hl=ko" /><link rel="alternate" hreflang="pt-BR" href="https://cloud.google.com/compute/docs/instances/creating-instance-with-custom-machine-type?hl=pt-br" /><link rel="alternate" hreflang="es-419" href="https://cloud.google.com/compute/docs/instances/creating-instance-with-custom-machine-type?hl=es-419" /><title>Create a VM with a custom machine type &nbsp;|&nbsp; Compute Engine Documentation &nbsp;|&nbsp; Google Cloud</title> <meta property="og:title" content="Create a VM with a custom machine type &nbsp;|&nbsp; Compute Engine Documentation &nbsp;|&nbsp; Google Cloud"><meta property="og:url" content="https://cloud.google.com/compute/docs/instances/creating-instance-with-custom-machine-type"><meta property="og:image" content="https://cloud.google.com/_static/cloud/images/social-icon-google-cloud-1200-630.png"> <meta property="og:image:width" content="1200"> <meta property="og:image:height" content="630"><meta property="og:locale" content="en"><meta name="twitter:card" content="summary_large_image"><script type="application/ld+json"> { "@context": "https://schema.org", "@type": "Article", "headline": "Create a VM with a custom machine type" } </script><script type="application/ld+json"> { "@context": "https://schema.org", "@type": "BreadcrumbList", "itemListElement": [{ "@type": "ListItem", "position": 1, "name": "Compute Engine", "item": "https://cloud.google.com/compute" },{ "@type": "ListItem", "position": 2, "name": "Documentation", "item": "https://cloud.google.com/compute/docs" },{ "@type": "ListItem", "position": 3, "name": "Create a VM with a custom machine type", "item": "https://cloud.google.com/compute/docs/instances/creating-instance-with-custom-machine-type" }] } </script> <link rel="stylesheet" href="/extras.css"></head> <body class="" template="page" theme="cloud-theme" type="article" layout="docs" free-trial display-toc pending> <devsite-progress type="indeterminate" id="app-progress"></devsite-progress> <section class="devsite-wrapper"> <devsite-cookie-notification-bar></devsite-cookie-notification-bar><cloudx-track userCountry="SG"></cloudx-track> <cloudx-utils-init></cloudx-utils-init> <devsite-header keep-tabs-visible> <div class="devsite-header--inner nocontent"> <div class="devsite-top-logo-row-wrapper-wrapper"> <div class="devsite-top-logo-row-wrapper"> <div class="devsite-top-logo-row"> <button type="button" id="devsite-hamburger-menu" class="devsite-header-icon-button button-flat material-icons gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Navigation menu button" visually-hidden aria-label="Open menu"> </button> <div class="devsite-product-name-wrapper"> <a href="/" class="devsite-site-logo-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Site logo" track-type="globalNav" track-name="googleCloud" track-metadata-position="nav" track-metadata-eventDetail="nav"> <picture> <img src="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/images/cloud-logo.svg" class="devsite-site-logo" alt="Google Cloud"> </picture> </a> <span class="devsite-product-name"> <ul class="devsite-breadcrumb-list" > <li class="devsite-breadcrumb-item devsite-has-google-wordmark"> </li> </ul> </span> </div> <div class="devsite-top-logo-row-middle"> <div class="devsite-header-upper-tabs"> <cloudx-tabs-nav class="upper-tabs"> <nav class="devsite-tabs-wrapper" aria-label="Upper tabs"> <tab class="devsite-active"> <a href="https://cloud.google.com/docs" track-metadata-eventdetail="https://cloud.google.com/docs" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - docs-home" track-metadata-module="primary nav" aria-label="Documentation, selected" data-category="Site-Wide Custom Events" data-label="Tab: Documentation" track-name="docs-home" track-link-column-type="single-column" > Documentation </a> </tab> <tab class="devsite-dropdown devsite-clickable "> <a href="https://cloud.google.com/docs/tech-area-overviews" track-metadata-eventdetail="https://cloud.google.com/docs/tech-area-overviews" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - technology-areas" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Technology areas" track-name="technology-areas" track-link-column-type="single-column" > Technology areas </a> <a href="#" role="button" aria-haspopup="true" aria-expanded="false" aria-label="Dropdown menu for Technology areas" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/tech-area-overviews" track-metadata-position="nav - technology-areas" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Technology areas" track-name="technology-areas" track-link-column-type="single-column" class="devsite-tabs-dropdown-toggle devsite-icon devsite-icon-arrow-drop-down"></a> <div class="devsite-tabs-dropdown" aria-label="submenu" hidden> <button class="devsite-tabs-close-button material-icons button-flat gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Close dropdown menu" aria-label="Close dropdown menu" track-type="nav" track-name="close" track-metadata-eventdetail="#" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav">close</button> <div class="devsite-tabs-dropdown-content"> <div class="devsite-tabs-dropdown-column "> <ul class="devsite-tabs-dropdown-section "> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/ai-ml" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/ai-ml" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> AI and ML </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/application-development" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/application-development" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Application development </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/application-hosting" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/application-hosting" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Application hosting </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/compute-area" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/compute-area" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Compute </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/data" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/data" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Data analytics and pipelines </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/databases" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/databases" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Databases </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/dhm-cloud" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/dhm-cloud" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Distributed, hybrid, and multicloud </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/generative-ai" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/generative-ai" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Generative AI </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/industry" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/industry" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Industry solutions </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/networking" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/networking" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Networking </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/observability" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/observability" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Observability and monitoring </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/security" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/security" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Security </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/storage" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/storage" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Storage </div> </a> </li> </ul> </div> </div> </div> </tab> <tab class="devsite-dropdown devsite-clickable "> <a href="https://cloud.google.com/docs/cross-product-overviews" track-metadata-eventdetail="https://cloud.google.com/docs/cross-product-overviews" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - crossproduct" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Cross-product tools" track-name="crossproduct" track-link-column-type="single-column" > Cross-product tools </a> <a href="#" role="button" aria-haspopup="true" aria-expanded="false" aria-label="Dropdown menu for Cross-product tools" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/cross-product-overviews" track-metadata-position="nav - crossproduct" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Cross-product tools" track-name="crossproduct" track-link-column-type="single-column" class="devsite-tabs-dropdown-toggle devsite-icon devsite-icon-arrow-drop-down"></a> <div class="devsite-tabs-dropdown" aria-label="submenu" hidden> <button class="devsite-tabs-close-button material-icons button-flat gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Close dropdown menu" aria-label="Close dropdown menu" track-type="nav" track-name="close" track-metadata-eventdetail="#" track-metadata-position="nav - crossproduct" track-metadata-module="tertiary nav">close</button> <div class="devsite-tabs-dropdown-content"> <div class="devsite-tabs-dropdown-column "> <ul class="devsite-tabs-dropdown-section "> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/access-resources" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/access-resources" track-metadata-position="nav - crossproduct" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Access and resources management </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/costs-usage" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/costs-usage" track-metadata-position="nav - crossproduct" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Costs and usage management </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/devtools" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/devtools" track-metadata-position="nav - crossproduct" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Cloud SDK, languages, frameworks, and tools </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/iac" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/iac" track-metadata-position="nav - crossproduct" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Infrastructure as code </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/migration" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/migration" track-metadata-position="nav - crossproduct" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Migration </div> </a> </li> </ul> </div> </div> </div> </tab> <tab class="devsite-dropdown devsite-clickable "> <a href="https://cloud.google.com/" track-metadata-eventdetail="https://cloud.google.com/" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - related-sites" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Related sites" track-name="related-sites" track-link-column-type="single-column" > Related sites </a> <a href="#" role="button" aria-haspopup="true" aria-expanded="false" aria-label="Dropdown menu for Related sites" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/" track-metadata-position="nav - related-sites" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Related sites" track-name="related-sites" track-link-column-type="single-column" class="devsite-tabs-dropdown-toggle devsite-icon devsite-icon-arrow-drop-down"></a> <div class="devsite-tabs-dropdown" aria-label="submenu" hidden> <button class="devsite-tabs-close-button material-icons button-flat gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Close dropdown menu" aria-label="Close dropdown menu" track-type="nav" track-name="close" track-metadata-eventdetail="#" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav">close</button> <div class="devsite-tabs-dropdown-content"> <div class="devsite-tabs-dropdown-column "> <ul class="devsite-tabs-dropdown-section "> <li class="devsite-nav-item"> <a href="https://cloud.google.com/" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Cloud Home </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/free" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/free" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Free Trial and Free Tier </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/architecture" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/architecture" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Architecture Center </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/blog" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/blog" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Blog </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/contact" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/contact" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Contact Sales </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/developers" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/developers" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Cloud Developer Center </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developers.google.com/" track-type="nav" track-metadata-eventdetail="https://developers.google.com/" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Developer Center </div> </a> </li> <li class="devsite-nav-item"> <a href="https://console.cloud.google.com/marketplace" track-type="nav" track-metadata-eventdetail="https://console.cloud.google.com/marketplace" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Cloud Marketplace </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/marketplace/docs" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/marketplace/docs" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Cloud Marketplace Documentation </div> </a> </li> <li class="devsite-nav-item"> <a href="https://www.cloudskillsboost.google/paths" track-type="nav" track-metadata-eventdetail="https://www.cloudskillsboost.google/paths" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Cloud Skills Boost </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/solutions" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/solutions" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Cloud Solution Center </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/support-hub" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/support-hub" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Cloud Support </div> </a> </li> <li class="devsite-nav-item"> <a href="https://www.youtube.com/@googlecloudtech" track-type="nav" track-metadata-eventdetail="https://www.youtube.com/@googlecloudtech" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Cloud Tech Youtube Channel </div> </a> </li> </ul> </div> </div> </div> </tab> </nav> </cloudx-tabs-nav> </div> <devsite-search enable-signin enable-search enable-suggestions project-name="Compute Engine Documentation" tenant-name="Google Cloud" project-scope="/compute/docs" url-scoped="https://cloud.google.com/s/results/compute/docs" > <form class="devsite-search-form" action="https://cloud.google.com/s/results" method="GET"> <div class="devsite-search-container"> <button type="button" search-open class="devsite-search-button devsite-header-icon-button button-flat material-icons" aria-label="Open search"></button> <div class="devsite-searchbox"> <input aria-activedescendant="" aria-autocomplete="list" aria-label="Search" aria-expanded="false" aria-haspopup="listbox" autocomplete="off" class="devsite-search-field devsite-search-query" name="q" placeholder="Search" role="combobox" type="text" value="" > <div class="devsite-search-image material-icons" aria-hidden="true"> </div> <div class="devsite-search-shortcut-icon-container" aria-hidden="true"> <kbd class="devsite-search-shortcut-icon">/</kbd> </div> </div> </div> </form> <button type="button" search-close class="devsite-search-button devsite-header-icon-button button-flat material-icons" aria-label="Close search"></button> </devsite-search> </div> <devsite-language-selector> <ul role="presentation"> <li role="presentation"> <a role="menuitem" lang="en" >English</a> </li> <li role="presentation"> <a role="menuitem" lang="de" >Deutsch</a> </li> <li role="presentation"> <a role="menuitem" lang="es_419" >Español – América Latina</a> </li> <li role="presentation"> <a role="menuitem" lang="fr" >Français</a> </li> <li role="presentation"> <a role="menuitem" lang="id" >Indonesia</a> </li> <li role="presentation"> <a role="menuitem" lang="it" >Italiano</a> </li> <li role="presentation"> <a role="menuitem" lang="pt_br" >Português – Brasil</a> </li> <li role="presentation"> <a role="menuitem" lang="zh_cn" >中文 – 简体</a> </li> <li role="presentation"> <a role="menuitem" lang="ja" >日本語</a> </li> <li role="presentation"> <a role="menuitem" lang="ko" >한국어</a> </li> </ul> </devsite-language-selector> <devsite-user enable-profiles fp-auth id="devsite-user"> <span class="button devsite-top-button" aria-hidden="true" visually-hidden>Sign in</span> </devsite-user> </div> </div> </div> <div class="devsite-collapsible-section "> <div class="devsite-header-background"> <div class="devsite-product-id-row" hidden> <div class="devsite-product-description-row"> </div> </div> <div class="devsite-doc-set-nav-row"> <ul class="devsite-breadcrumb-list" > <li class="devsite-breadcrumb-item "> <a href="https://cloud.google.com/compute" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Lower Header" data-value="1" track-type="globalNav" track-name="breadcrumb" track-metadata-position="1" track-metadata-eventdetail="Compute Engine: Virtual Machines (VMs)" > Compute Engine </a> </li> </ul> <cloudx-tabs-nav class="lower-tabs"> <nav class="devsite-tabs-wrapper" aria-label="Lower tabs"> <tab class="devsite-active"> <a href="https://cloud.google.com/compute/docs/overview" track-metadata-eventdetail="https://cloud.google.com/compute/docs/overview" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - guides" track-metadata-module="primary nav" aria-label="Guides, selected" data-category="Site-Wide Custom Events" data-label="Tab: Guides" track-name="guides" > Guides </a> </tab> <tab > <a href="https://cloud.google.com/compute/docs/apis" track-metadata-eventdetail="https://cloud.google.com/compute/docs/apis" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - reference" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Reference" track-name="reference" > Reference </a> </tab> <tab > <a href="https://cloud.google.com/compute/docs/samples" track-metadata-eventdetail="https://cloud.google.com/compute/docs/samples" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - samples" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Samples" track-name="samples" > Samples </a> </tab> <tab > <a href="https://cloud.google.com/compute/docs/resources" track-metadata-eventdetail="https://cloud.google.com/compute/docs/resources" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - resources" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Resources" track-name="resources" > Resources </a> </tab> </nav> </cloudx-tabs-nav> <div class="devsite-product-button-row"> <a href="https://cloud.google.com/contact" class="cta-button-secondary button " track-type="contact" data-overflow-wrapper="tab" data-overflow-container="left" track-name="sales" track-metadata-eventDetail="nav" track-metadata-position="nav" data-overflow="devsite-tabs-wrapper" >Contact Us</a> <a href="//console.cloud.google.com/freetrial" class="cloud-free-trial-button cta-button-primary button-primary button cloud-button cloud-button--primary " referrerpolicy="no-referrer-when-downgrade" track-metadata-position="nav" data-overflow-class="devsite-header-link devsite-top-button button cloud-free-trial-button cloud-free-trial-enabled cloud-button cloud-button--primary" data-overflow="devsite-top-logo-row" data-overflow-container="right" track-name="gcpCta" track-type="freeTrial" track-metadata-eventDetail="nav" >Start free</a> </div> </div> </div> </div> </div> </devsite-header> <devsite-book-nav scrollbars > <div class="devsite-book-nav-filter" > <span class="filter-list-icon material-icons" aria-hidden="true"></span> <input type="text" placeholder="Filter" aria-label="Type to filter" role="searchbox"> <span class="filter-clear-button hidden" data-title="Clear filter" aria-label="Clear filter" role="button" tabindex="0"></span> </div> <nav class="devsite-book-nav devsite-nav nocontent" aria-label="Side menu"> <div class="devsite-mobile-header"> <button type="button" id="devsite-close-nav" class="devsite-header-icon-button button-flat material-icons gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Close navigation" aria-label="Close navigation"> </button> <div class="devsite-product-name-wrapper"> <a href="/" class="devsite-site-logo-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Site logo" track-type="globalNav" track-name="googleCloud" track-metadata-position="nav" track-metadata-eventDetail="nav"> <picture> <img src="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/images/cloud-logo.svg" class="devsite-site-logo" alt="Google Cloud"> </picture> </a> <span class="devsite-product-name"> <ul class="devsite-breadcrumb-list" > <li class="devsite-breadcrumb-item devsite-has-google-wordmark"> </li> </ul> </span> </div> </div> <div class="devsite-book-nav-wrapper"> <div class="devsite-mobile-nav-top"> <ul class="devsite-nav-list"> <li class="devsite-nav-item"> <a href="/docs" class="devsite-nav-title gc-analytics-event devsite-nav-active" data-category="Site-Wide Custom Events" data-label="Tab: Documentation" track-name="docs-home" track-link-column-type="single-column" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Documentation" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Documentation </span> </a> <ul class="devsite-nav-responsive-tabs"> <li class="devsite-nav-item"> <a href="/compute/docs/overview" class="devsite-nav-title gc-analytics-event devsite-nav-has-children devsite-nav-active" data-category="Site-Wide Custom Events" data-label="Tab: Guides" track-name="guides" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Guides" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip menu="_book"> Guides </span> <span class="devsite-nav-icon material-icons" data-icon="forward" menu="_book"> </span> </a> </li> <li class="devsite-nav-item"> <a href="/compute/docs/apis" class="devsite-nav-title gc-analytics-event devsite-nav-has-children " data-category="Site-Wide Custom Events" data-label="Tab: Reference" track-name="reference" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Reference" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Reference </span> <span class="devsite-nav-icon material-icons" data-icon="forward" > </span> </a> </li> <li class="devsite-nav-item"> <a href="/compute/docs/samples" class="devsite-nav-title gc-analytics-event devsite-nav-has-children " data-category="Site-Wide Custom Events" data-label="Tab: Samples" track-name="samples" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Samples" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Samples </span> <span class="devsite-nav-icon material-icons" data-icon="forward" > </span> </a> </li> <li class="devsite-nav-item"> <a href="/compute/docs/resources" class="devsite-nav-title gc-analytics-event devsite-nav-has-children " data-category="Site-Wide Custom Events" data-label="Tab: Resources" track-name="resources" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Resources" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Resources </span> <span class="devsite-nav-icon material-icons" data-icon="forward" > </span> </a> </li> </ul> </li> <li class="devsite-nav-item"> <a href="/docs/tech-area-overviews" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Tab: Technology areas" track-name="technology-areas" track-link-column-type="single-column" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Technology areas" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Technology areas </span> </a> <ul class="devsite-nav-responsive-tabs devsite-nav-has-menu "> <li class="devsite-nav-item"> <span class="devsite-nav-title" tooltip data-category="Site-Wide Custom Events" data-label="Tab: Technology areas" track-name="technology-areas" track-link-column-type="single-column" > <span class="devsite-nav-text" tooltip menu="Technology areas"> More </span> <span class="devsite-nav-icon material-icons" data-icon="forward" menu="Technology areas"> </span> </span> </li> </ul> </li> <li class="devsite-nav-item"> <a href="/docs/cross-product-overviews" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Tab: Cross-product tools" track-name="crossproduct" track-link-column-type="single-column" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Cross-product tools" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Cross-product tools </span> </a> <ul class="devsite-nav-responsive-tabs devsite-nav-has-menu "> <li class="devsite-nav-item"> <span class="devsite-nav-title" tooltip data-category="Site-Wide Custom Events" data-label="Tab: Cross-product tools" track-name="crossproduct" track-link-column-type="single-column" > <span class="devsite-nav-text" tooltip menu="Cross-product tools"> More </span> <span class="devsite-nav-icon material-icons" data-icon="forward" menu="Cross-product tools"> </span> </span> </li> </ul> </li> <li class="devsite-nav-item"> <a href="/" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Tab: Related sites" track-name="related-sites" track-link-column-type="single-column" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Related sites" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Related sites </span> </a> <ul class="devsite-nav-responsive-tabs devsite-nav-has-menu "> <li class="devsite-nav-item"> <span class="devsite-nav-title" tooltip data-category="Site-Wide Custom Events" data-label="Tab: Related sites" track-name="related-sites" track-link-column-type="single-column" > <span class="devsite-nav-text" tooltip menu="Related sites"> More </span> <span class="devsite-nav-icon material-icons" data-icon="forward" menu="Related sites"> </span> </span> </li> </ul> </li> <li class="devsite-nav-item"> <a href="//console.cloud.google.com/" class="devsite-nav-title gc-analytics-event " track-metadata-position="nav" track-metadata-eventDetail="nav" track-name="console" referrerpolicy="no-referrer-when-downgrade" track-type="globalNav" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Console" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Console </span> </a> </li> <li class="devsite-nav-item"> <a href="/contact" class="cta-button-secondary button" track-type="contact" data-overflow-wrapper="tab" data-overflow-container="left" track-name="sales" track-metadata-eventDetail="nav" track-metadata-position="nav" data-overflow="devsite-tabs-wrapper" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Contact Us" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Contact Us </span> </a> </li> <li class="devsite-nav-item"> <a href="//console.cloud.google.com/freetrial" class="cloud-free-trial-button cta-button-primary button-primary button cloud-button cloud-button--primary" referrerpolicy="no-referrer-when-downgrade" track-metadata-position="nav" data-overflow-class="devsite-header-link devsite-top-button button cloud-free-trial-button cloud-free-trial-enabled cloud-button cloud-button--primary" data-overflow="devsite-top-logo-row" data-overflow-container="right" track-name="gcpCta" track-type="freeTrial" track-metadata-eventDetail="nav" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Start free" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Start free </span> </a> </li> </ul> </div> <div class="devsite-mobile-nav-bottom"> <ul class="devsite-nav-list" menu="_book"> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Discover</span> </div></li> <li class="devsite-nav-item"><a href="/compute/docs/overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/overview" ><span class="devsite-nav-text" tooltip>Product overview</span></a></li> <li class="devsite-nav-item"><a href="/compute/docs/instances" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances" ><span class="devsite-nav-text" tooltip>Virtual machine instances</span></a></li> <li class="devsite-nav-item"><a href="/compute/docs/instance-groups" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups" ><span class="devsite-nav-text" tooltip>Instance groups</span></a></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Machine type families</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/machine-resource" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/machine-resource" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/machine-resource" ><span class="devsite-nav-text" tooltip>Machine resource guide</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/general-purpose-machines" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/general-purpose-machines" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/general-purpose-machines" ><span class="devsite-nav-text" tooltip>General-purpose machines</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/storage-optimized-machines" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/storage-optimized-machines" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/storage-optimized-machines" ><span class="devsite-nav-text" tooltip>Storage-optimized machines</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/compute-optimized-machines" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/compute-optimized-machines" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/compute-optimized-machines" ><span class="devsite-nav-text" tooltip>Compute-optimized machines</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/memory-optimized-machines" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/memory-optimized-machines" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/memory-optimized-machines" ><span class="devsite-nav-text" tooltip>Memory-optimized machines</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/accelerator-optimized-machines" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/accelerator-optimized-machines" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/accelerator-optimized-machines" ><span class="devsite-nav-text" tooltip>Accelerator-optimized machines</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/coremark-scores-of-vm-instances" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/coremark-scores-of-vm-instances" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/coremark-scores-of-vm-instances" ><span class="devsite-nav-text" tooltip>CoreMark scores of VM instances by family</span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/compute/docs/cpu-platforms" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/cpu-platforms" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/cpu-platforms" ><span class="devsite-nav-text" tooltip>CPU platforms</span></a></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>GPUs</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/gpus/overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/gpus/overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/gpus/overview" ><span class="devsite-nav-text" tooltip>About GPUs on Google Cloud</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/gpus" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/gpus" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/gpus" ><span class="devsite-nav-text" tooltip>GPU machine types</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Regions and zones</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/regions-zones" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/regions-zones" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/regions-zones" ><span class="devsite-nav-text" tooltip>About regions and zones</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/gpus/gpu-regions-zones" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/gpus/gpu-regions-zones" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/gpus/gpu-regions-zones" ><span class="devsite-nav-text" tooltip>GPU regions and zones</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/regions-zones/global-regional-zonal-resources" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/regions-zones/global-regional-zonal-resources" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/regions-zones/global-regional-zonal-resources" ><span class="devsite-nav-text" tooltip>Global, regional, and zonal resources</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/regions-zones/zone-virtualization" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/regions-zones/zone-virtualization" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/regions-zones/zone-virtualization" ><span class="devsite-nav-text" tooltip>Zone virtualization</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Get started</span> </div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Plan and prepare</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Work with regions and zones</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/regions-zones/viewing-regions-zones" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/regions-zones/viewing-regions-zones" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/regions-zones/viewing-regions-zones" ><span class="devsite-nav-text" tooltip>View available regions and zones</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/regions-zones/changing-default-zone-region" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/regions-zones/changing-default-zone-region" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/regions-zones/changing-default-zone-region" ><span class="devsite-nav-text" tooltip>Change the default region or zone</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Review VM deployment options</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/choose-compute-deployment-option" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/choose-compute-deployment-option" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/choose-compute-deployment-option" ><span class="devsite-nav-text" tooltip>Choose a deployment strategy</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/about-vm-tenancy" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/about-vm-tenancy" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/about-vm-tenancy" ><span class="devsite-nav-text" tooltip>About VM tenancy</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/arm-on-compute" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/arm-on-compute" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/arm-on-compute" ><span class="devsite-nav-text" tooltip>Arm VMs on Compute</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/tutorials/robustsystems" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/tutorials/robustsystems" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/tutorials/robustsystems" ><span class="devsite-nav-text" tooltip>Design resilient systems</span></a></li></ul></div></li><li class="devsite-nav-item"><a href="/compute/docs/networking/network-overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/networking/network-overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/networking/network-overview" ><span class="devsite-nav-text" tooltip>Networking overview for VMs</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Images and operating systems</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>OS images</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/images" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/images" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/images" ><span class="devsite-nav-text" tooltip>About OS images</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/images/os-details" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/images/os-details" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/images/os-details" ><span class="devsite-nav-text" tooltip>Operating system details</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/images/os-image-lifecycle" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/images/os-image-lifecycle" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/images/os-image-lifecycle" ><span class="devsite-nav-text" tooltip>OS image lifecycle</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/images/support-maintenance-policy" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/images/support-maintenance-policy" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/images/support-maintenance-policy" ><span class="devsite-nav-text" tooltip>Support policy</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Premium operating systems</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/images/premium/rhel-faq" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/images/premium/rhel-faq" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/images/premium/rhel-faq" ><span class="devsite-nav-text" tooltip>RHEL FAQ</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/images/premium/sles-faq" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/images/premium/sles-faq" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/images/premium/sles-faq" ><span class="devsite-nav-text" tooltip>SLES FAQ</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/images/premium/ubuntu-pro-faq" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/images/premium/ubuntu-pro-faq" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/images/premium/ubuntu-pro-faq" ><span class="devsite-nav-text" tooltip>Ubuntu Pro FAQ</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/windows/ms-licensing" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/windows/ms-licensing" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/windows/ms-licensing" ><span class="devsite-nav-text" tooltip>Microsoft Licensing on Google Cloud</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/windows/ms-licensing-faq" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/windows/ms-licensing-faq" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/windows/ms-licensing-faq" ><span class="devsite-nav-text" tooltip>Microsoft licenses FAQ</span></a></li></ul></div></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Access control</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/access" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/access" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/access" ><span class="devsite-nav-text" tooltip>Access control overview</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/access/managing-access-to-resources" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/access/managing-access-to-resources" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/access/managing-access-to-resources" ><span class="devsite-nav-text" tooltip>Manage access to Compute Engine resources</span></a></li><li class="devsite-nav-item devsite-nav-preview"><a href="/compute/docs/access/custom-constraints" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/access/custom-constraints" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/access/custom-constraints" ><span class="devsite-nav-text" tooltip>Manage resources by using custom constraints</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span></a></li><li class="devsite-nav-item"><a href="/compute/docs/access/iam" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/access/iam" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/access/iam" ><span class="devsite-nav-text" tooltip>IAM roles and permissions</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/access/service-accounts" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/access/service-accounts" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/access/service-accounts" ><span class="devsite-nav-text" tooltip>Service accounts</span></a></li></ul></div></li><li class="devsite-nav-item"><a href="/compute/docs/naming-resources" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/naming-resources" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/naming-resources" ><span class="devsite-nav-text" tooltip>Name resources</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Quickstarts</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/create-linux-vm-instance" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/create-linux-vm-instance" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/create-linux-vm-instance" ><span class="devsite-nav-text" tooltip>Create a Linux VM</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/create-windows-server-vm-instance" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/create-windows-server-vm-instance" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/create-windows-server-vm-instance" ><span class="devsite-nav-text" tooltip>Create a Windows Server VM</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/quickstart-mig" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/quickstart-mig" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/quickstart-mig" ><span class="devsite-nav-text" tooltip>Create a managed instance group</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Create VMs</span> </div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Create a VM</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/create-start-instance" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/create-start-instance" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/create-start-instance" ><span class="devsite-nav-text" tooltip>Create and start a VM</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/access/create-enable-service-accounts-for-instances" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/access/create-enable-service-accounts-for-instances" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/access/create-enable-service-accounts-for-instances" ><span class="devsite-nav-text" tooltip>Create a VM that uses a user-managed service account</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/create-vm-from-similar-instance" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/create-vm-from-similar-instance" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/create-vm-from-similar-instance" ><span class="devsite-nav-text" tooltip>Create a VM similar to an existing VM</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/custom-hostname-vm" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/custom-hostname-vm" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/custom-hostname-vm" ><span class="devsite-nav-text" tooltip>Create a VM with a custom hostname</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/creating-instance-with-custom-machine-type" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/creating-instance-with-custom-machine-type" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/creating-instance-with-custom-machine-type" ><span class="devsite-nav-text" tooltip>Create a VM with a custom machine type</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/create-vm-from-instance-template" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/create-vm-from-instance-template" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/create-vm-from-instance-template" ><span class="devsite-nav-text" tooltip>Create a VM from an instance template</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Create a VM that has attached GPUs</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/gpus/create-vm-with-gpus" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/gpus/create-vm-with-gpus" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/gpus/create-vm-with-gpus" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Accelerator-optimized VMs</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/gpus/create-gpu-vm-accelerator-optimized" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/gpus/create-gpu-vm-accelerator-optimized" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/gpus/create-gpu-vm-accelerator-optimized" ><span class="devsite-nav-text" tooltip>Create an accelerator-optimized VM</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/gpus/gpudirect" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/gpus/gpudirect" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/gpus/gpudirect" ><span class="devsite-nav-text" tooltip>Create an A3 VM with GPUDirect-TCPX enabled</span></a></li></ul></div></li><li class="devsite-nav-item"><a href="/compute/docs/gpus/create-gpu-vm-general-purpose" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/gpus/create-gpu-vm-general-purpose" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/gpus/create-gpu-vm-general-purpose" ><span class="devsite-nav-text" tooltip>Create an N1 VM that has attached GPUs</span></a></li></ul></div></li><li class="devsite-nav-item"><a href="/compute/docs/instances/windows/creating-managing-windows-instances" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/windows/creating-managing-windows-instances" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/windows/creating-managing-windows-instances" ><span class="devsite-nav-text" tooltip>Create and manage Windows Server VMs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/sql-server/creating-sql-server-instances" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/sql-server/creating-sql-server-instances" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/sql-server/creating-sql-server-instances" ><span class="devsite-nav-text" tooltip>Create SQL Server VMs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/create-rhel-byos-vm" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/create-rhel-byos-vm" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/create-rhel-byos-vm" ><span class="devsite-nav-text" tooltip>Create a VM using a RHEL BYOS image</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/create-hpc-vm" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/create-hpc-vm" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/create-hpc-vm" ><span class="devsite-nav-text" tooltip>Create an HPC-ready VM</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Create Spot VMs</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Spot VMs</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/spot" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/spot" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/spot" ><span class="devsite-nav-text" tooltip>About Spot VMs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/create-use-spot" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/create-use-spot" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/create-use-spot" ><span class="devsite-nav-text" tooltip>Create and use Spot VMs</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Preemptible VMs</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-unsupported"><a href="/compute/docs/instances/preemptible" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/preemptible" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/preemptible" ><span class="devsite-nav-text" tooltip>About preemptible VMs</span><span class="devsite-nav-icon material-icons" data-icon="unsupported" data-title="No longer supported" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-unsupported"><a href="/compute/docs/instances/create-use-preemptible" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/create-use-preemptible" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/create-use-preemptible" ><span class="devsite-nav-text" tooltip>Create and use preemptible VMs</span><span class="devsite-nav-icon material-icons" data-icon="unsupported" data-title="No longer supported" aria-hidden="true"></span></a></li></ul></div></li></ul></div></li><li class="devsite-nav-item"><a href="/compute/docs/instances/specify-min-cpu-platform" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/specify-min-cpu-platform" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/specify-min-cpu-platform" ><span class="devsite-nav-text" tooltip>Specify a minimum CPU platform for a VM</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Create custom images</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/images/building-custom-os" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/images/building-custom-os" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/images/building-custom-os" ><span class="devsite-nav-text" tooltip>Requirements to build custom images</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/images/create-custom" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/images/create-custom" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/images/create-custom" ><span class="devsite-nav-text" tooltip>Create custom images</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/images/creating-custom-windows-byol-images" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/images/creating-custom-windows-byol-images" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/images/creating-custom-windows-byol-images" ><span class="devsite-nav-text" tooltip>Create custom Windows BYOL base images</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/windows/creating-windows-os-image" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/windows/creating-windows-os-image" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/windows/creating-windows-os-image" ><span class="devsite-nav-text" tooltip>Create custom Windows Server images</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Create and manage instance templates</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instance-templates" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-templates" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-templates" ><span class="devsite-nav-text" tooltip>About instance templates</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-templates/create-instance-templates" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-templates/create-instance-templates" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-templates/create-instance-templates" ><span class="devsite-nav-text" tooltip>Create instance templates</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-templates/deterministic-instance-templates" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-templates/deterministic-instance-templates" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-templates/deterministic-instance-templates" ><span class="devsite-nav-text" tooltip>Deterministic instance templates</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-templates/get-list-delete-instance-templates" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-templates/get-list-delete-instance-templates" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-templates/get-list-delete-instance-templates" ><span class="devsite-nav-text" tooltip>Get, list, and delete instance templates</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Create multiple VMs</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Create a managed instance group (MIG)</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/creating-groups-of-managed-instances" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/creating-groups-of-managed-instances" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/creating-groups-of-managed-instances" ><span class="devsite-nav-text" tooltip>Basic scenarios for creating MIGs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/create-zonal-mig" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/create-zonal-mig" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/create-zonal-mig" ><span class="devsite-nav-text" tooltip>Create a MIG in a single zone</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/distributing-instances-with-regional-instance-groups" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/distributing-instances-with-regional-instance-groups" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/distributing-instances-with-regional-instance-groups" ><span class="devsite-nav-text" tooltip>Create a MIG in multiple zones in a region</span></a></li><li class="devsite-nav-item devsite-nav-preview"><a href="/compute/docs/instance-groups/create-mig-with-multiple-machine-types" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/create-mig-with-multiple-machine-types" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/create-mig-with-multiple-machine-types" ><span class="devsite-nav-text" tooltip>Create a MIG with multiple machine types</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/create-mig-from-vm" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/create-mig-from-vm" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/create-mig-from-vm" ><span class="devsite-nav-text" tooltip>Create a MIG from an existing VM</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/create-mig-with-basic-autoscaling" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/create-mig-with-basic-autoscaling" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/create-mig-with-basic-autoscaling" ><span class="devsite-nav-text" tooltip>Create a MIG with autoscaling</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/create-mig-with-preemptible-vms" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/create-mig-with-preemptible-vms" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/create-mig-with-preemptible-vms" ><span class="devsite-nav-text" tooltip>Create a MIG with preemptible VMs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/create-mig-with-gpu-vms" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/create-mig-with-gpu-vms" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/create-mig-with-gpu-vms" ><span class="devsite-nav-text" tooltip>Create a MIG with GPU VMs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/create-mig-with-basic-stateful-disks" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/create-mig-with-basic-stateful-disks" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/create-mig-with-basic-stateful-disks" ><span class="devsite-nav-text" tooltip>Create a MIG with stateful configuration</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Bulk creation of VMs</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/multiple/about-bulk-creation" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/multiple/about-bulk-creation" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/multiple/about-bulk-creation" ><span class="devsite-nav-text" tooltip>About bulk creation of VMs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/multiple/create-in-bulk" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/multiple/create-in-bulk" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/multiple/create-in-bulk" ><span class="devsite-nav-text" tooltip>Create VMs in bulk</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/gpus/create-gpu-vm-bulk" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/gpus/create-gpu-vm-bulk" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/gpus/create-gpu-vm-bulk" ><span class="devsite-nav-text" tooltip>Create GPU VMs in bulk</span></a></li></ul></div></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Create sole-tenant VMs</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/nodes/sole-tenant-nodes" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/nodes/sole-tenant-nodes" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/nodes/sole-tenant-nodes" ><span class="devsite-nav-text" tooltip>Sole-tenancy overview</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/nodes/provisioning-sole-tenant-vms" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/nodes/provisioning-sole-tenant-vms" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/nodes/provisioning-sole-tenant-vms" ><span class="devsite-nav-text" tooltip>Provision a sole-tenant VM</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/nodes/sole-tenancy-advanced-maintenance-control" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/nodes/sole-tenancy-advanced-maintenance-control" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/nodes/sole-tenancy-advanced-maintenance-control" ><span class="devsite-nav-text" tooltip>Advanced maintenance control for sole-tenant nodes</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/nodes/sole-tenant-best-practices" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/nodes/sole-tenant-best-practices" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/nodes/sole-tenant-best-practices" ><span class="devsite-nav-text" tooltip>Sole-tenancy best practices</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/nodes/sole-tenancy-accounting-faq" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/nodes/sole-tenancy-accounting-faq" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/nodes/sole-tenancy-accounting-faq" ><span class="devsite-nav-text" tooltip>Sole-tenancy accounting FAQ</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Create a virtual workstation</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/virtual-workstation" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/virtual-workstation" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/virtual-workstation" ><span class="devsite-nav-text" tooltip>About creating virtual workstations</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/virtual-workstation/linux" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/virtual-workstation/linux" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/virtual-workstation/linux" ><span class="devsite-nav-text" tooltip>Create a virtual Linux workstation</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/virtual-workstation/windows" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/virtual-workstation/windows" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/virtual-workstation/windows" ><span class="devsite-nav-text" tooltip>Create a virtual Windows workstation</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/virtual-workstation/linux-gpu" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/virtual-workstation/linux-gpu" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/virtual-workstation/linux-gpu" ><span class="devsite-nav-text" tooltip>Create a virtual Linux workstation with an attached GPU</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/virtual-workstation/windows-gpu" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/virtual-workstation/windows-gpu" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/virtual-workstation/windows-gpu" ><span class="devsite-nav-text" tooltip>Create a virtual Windows workstation with an attached GPU</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Use nested virtualization</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/nested-virtualization/overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/nested-virtualization/overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/nested-virtualization/overview" ><span class="devsite-nav-text" tooltip>About nested virtualization</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/nested-virtualization/managing-constraint" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/nested-virtualization/managing-constraint" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/nested-virtualization/managing-constraint" ><span class="devsite-nav-text" tooltip>Manage the nested virtualization constraint</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/nested-virtualization/enabling" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/nested-virtualization/enabling" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/nested-virtualization/enabling" ><span class="devsite-nav-text" tooltip>Enable nested virtualization</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/nested-virtualization/creating-nested-vms" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/nested-virtualization/creating-nested-vms" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/nested-virtualization/creating-nested-vms" ><span class="devsite-nav-text" tooltip>Create nested VMs</span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/compute/docs/instances/enable-instance-virtual-display" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/enable-instance-virtual-display" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/enable-instance-virtual-display" ><span class="devsite-nav-text" tooltip>Enable virtual displays on a VM</span></a></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Manage VM boot disks</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/disks/detach-reattach-boot-disk" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/detach-reattach-boot-disk" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/detach-reattach-boot-disk" ><span class="devsite-nav-text" tooltip>Detach and reattach a boot disk</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/create-root-persistent-disks" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/create-root-persistent-disks" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/create-root-persistent-disks" ><span class="devsite-nav-text" tooltip>Create a customized boot disk</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Migrate VMs</span> </div></li> <li class="devsite-nav-item"><a href="/compute/docs/import" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/import" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/import" ><span class="devsite-nav-text" tooltip>Choose a migration path</span></a></li> <li class="devsite-nav-item"><a href="/compute/docs/nodes/bringing-your-own-licenses" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/nodes/bringing-your-own-licenses" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/nodes/bringing-your-own-licenses" ><span class="devsite-nav-text" tooltip>Bring your own licenses</span></a></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Import disks and images</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/import/requirements-export-import-images" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/import/requirements-export-import-images" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/import/requirements-export-import-images" ><span class="devsite-nav-text" tooltip>Prerequisites for importing and exporting VM images</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Automatic import</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/import/importing-virtual-disks" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/import/importing-virtual-disks" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/import/importing-virtual-disks" ><span class="devsite-nav-text" tooltip>Import virtual disks</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/import/import-ovf-files" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/import/import-ovf-files" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/import/import-ovf-files" ><span class="devsite-nav-text" tooltip>Import virtual appliances</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/import/import-aws-image" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/import/import-aws-image" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/import/import-aws-image" ><span class="devsite-nav-text" tooltip>Import images from AWS</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Manual import</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/import/import-existing-image" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/import/import-existing-image" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/import/import-existing-image" ><span class="devsite-nav-text" tooltip>Manually import boot disks</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/import/configuring-imported-images" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/import/configuring-imported-images" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/import/configuring-imported-images" ><span class="devsite-nav-text" tooltip>Manually configure imported disks</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/images/creating-an-image-from-an-iso-file" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/images/creating-an-image-from-an-iso-file" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/images/creating-an-image-from-an-iso-file" ><span class="devsite-nav-text" tooltip>Create a persistent disk image from an ISO file</span></a></li></ul></div></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Move a VM within Google Cloud</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/moving-instance-across-zones" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/moving-instance-across-zones" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/moving-instance-across-zones" ><span class="devsite-nav-text" tooltip>Move a VM between zones</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/migrating-interfaces-between-networks" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/migrating-interfaces-between-networks" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/migrating-interfaces-between-networks" ><span class="devsite-nav-text" tooltip>Migrate a VM between networks</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/copy-vm-between-projects" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/copy-vm-between-projects" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/copy-vm-between-projects" ><span class="devsite-nav-text" tooltip>Copy VMs between projects</span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/compute/docs/import/migrate-to-new-vm" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/import/migrate-to-new-vm" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/import/migrate-to-new-vm" ><span class="devsite-nav-text" tooltip>Move an existing VM to a new VM</span></a></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Connect to VMs</span> </div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Connect to a VM</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/ssh" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/ssh" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/ssh" ><span class="devsite-nav-text" tooltip>About SSH connections</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Linux VMs</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/connect/standard-ssh" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/connect/standard-ssh" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/connect/standard-ssh" ><span class="devsite-nav-text" tooltip>Connect to VMs</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Connect through internal IP addresses</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/connect/ssh-internal-ip" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/connect/ssh-internal-ip" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/connect/ssh-internal-ip" ><span class="devsite-nav-text" tooltip>Connection options for internal-only VMs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/connect/ssh-using-iap" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/connect/ssh-using-iap" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/connect/ssh-using-iap" ><span class="devsite-nav-text" tooltip>Connect using IAP</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/connect/ssh-using-bastion-host" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/connect/ssh-using-bastion-host" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/connect/ssh-using-bastion-host" ><span class="devsite-nav-text" tooltip>Connect using a bastion host</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/connect/ssh-using-vpn" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/connect/ssh-using-vpn" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/connect/ssh-using-vpn" ><span class="devsite-nav-text" tooltip>Connect using Cloud VPN</span></a></li></ul></div></li><li class="devsite-nav-item"><a href="/compute/docs/connect/root-ssh" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/connect/root-ssh" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/connect/root-ssh" ><span class="devsite-nav-text" tooltip>Connect as the root user</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/connect/set-up-service-account-ssh" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/connect/set-up-service-account-ssh" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/connect/set-up-service-account-ssh" ><span class="devsite-nav-text" tooltip>Connect using service accounts</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/tutorials/service-account-ssh" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/tutorials/service-account-ssh" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/tutorials/service-account-ssh" ><span class="devsite-nav-text" tooltip>Configure apps to use SSH</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Best practices</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/solutions/connecting-securely" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /solutions/connecting-securely" track-type="bookNav" track-name="click" track-metadata-eventdetail="/solutions/connecting-securely" ><span class="devsite-nav-text" tooltip>Securely connect to VMs</span></a></li></ul></div></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Windows VMs</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/connecting-to-windows" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/connecting-to-windows" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/connecting-to-windows" ><span class="devsite-nav-text" tooltip>Connect to Windows VMs using RDP</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/connecting-to-sac" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/connecting-to-sac" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/connecting-to-sac" ><span class="devsite-nav-text" tooltip>Connect to Windows VMs using the SAC</span></a></li><li class="devsite-nav-item devsite-nav-preview"><a href="/compute/docs/connect/windows-ssh" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/connect/windows-ssh" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/connect/windows-ssh" ><span class="devsite-nav-text" tooltip>Connect to Windows VMs using SSH</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/windows/connecting-powershell" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/windows/connecting-powershell" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/windows/connecting-powershell" ><span class="devsite-nav-text" tooltip>Connect to Windows VMs using PowerShell</span></a></li></ul></div></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Manage access to VMs</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Linux VMs</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/access-overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/access-overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/access-overview" ><span class="devsite-nav-text" tooltip>Choose an access management method</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/oslogin" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/oslogin" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/oslogin" ><span class="devsite-nav-text" tooltip>About OS Login</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/oslogin/set-up-oslogin" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/oslogin/set-up-oslogin" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/oslogin/set-up-oslogin" ><span class="devsite-nav-text" tooltip>Set up OS Login</span></a></li><li class="devsite-nav-item devsite-nav-preview"><a href="/compute/docs/oslogin/security-keys" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/oslogin/security-keys" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/oslogin/security-keys" ><span class="devsite-nav-text" tooltip>Enable security keys with OS Login</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span></a></li><li class="devsite-nav-item"><a href="/compute/docs/oslogin/manage-oslogin-in-an-org" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/oslogin/manage-oslogin-in-an-org" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/oslogin/manage-oslogin-in-an-org" ><span class="devsite-nav-text" tooltip>Manage OS Login in an organization</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/oslogin/view-audit-logs" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/oslogin/view-audit-logs" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/oslogin/view-audit-logs" ><span class="devsite-nav-text" tooltip>Monitor OS Login audit logs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/permissions-tutorial" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/permissions-tutorial" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/permissions-tutorial" ><span class="devsite-nav-text" tooltip>Configure granular access within VMs</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Windows VMs</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/windows/generating-credentials" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/windows/generating-credentials" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/windows/generating-credentials" ><span class="devsite-nav-text" tooltip>Manage accounts and credentials on Windows VMs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/windows/automate-pw-generation" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/windows/automate-pw-generation" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/windows/automate-pw-generation" ><span class="devsite-nav-text" tooltip>Automate Windows password generation</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Manually manage SSH keys</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/connect/create-ssh-keys" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/connect/create-ssh-keys" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/connect/create-ssh-keys" ><span class="devsite-nav-text" tooltip>Create SSH keys</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/connect/add-ssh-keys" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/connect/add-ssh-keys" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/connect/add-ssh-keys" ><span class="devsite-nav-text" tooltip>Add SSH keys to VMs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/connect/restrict-ssh-keys" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/connect/restrict-ssh-keys" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/connect/restrict-ssh-keys" ><span class="devsite-nav-text" tooltip>Restrict SSH keys from VMs</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Best practices for securing SSH access</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/connect/ssh-best-practices" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/connect/ssh-best-practices" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/connect/ssh-best-practices" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/connect/ssh-best-practices/network-access" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/connect/ssh-best-practices/network-access" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/connect/ssh-best-practices/network-access" ><span class="devsite-nav-text" tooltip>Control network access</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/connect/ssh-best-practices/login-access" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/connect/ssh-best-practices/login-access" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/connect/ssh-best-practices/login-access" ><span class="devsite-nav-text" tooltip>Control SSH login access</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/connect/ssh-best-practices/credentials" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/connect/ssh-best-practices/credentials" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/connect/ssh-best-practices/credentials" ><span class="devsite-nav-text" tooltip>Protect SSH credentials</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/connect/ssh-best-practices/auditing" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/connect/ssh-best-practices/auditing" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/connect/ssh-best-practices/auditing" ><span class="devsite-nav-text" tooltip>Audit SSH access</span></a></li></ul></div></li><li class="devsite-nav-item"><a href="/compute/docs/tag-resources" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/tag-resources" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/tag-resources" ><span class="devsite-nav-text" tooltip>Manage tags for resources</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Transfer files to or from a VM</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/transfer-files" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/transfer-files" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/transfer-files" ><span class="devsite-nav-text" tooltip>Transfer files to Linux VMs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/transfer-files-windows" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/transfer-files-windows" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/transfer-files-windows" ><span class="devsite-nav-text" tooltip>Transfer files to Windows VMs</span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/compute/docs/ip-addresses" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/ip-addresses" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/ip-addresses" ><span class="devsite-nav-text" tooltip>IP addresses</span></a></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Internal DNS</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/internal-dns" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/internal-dns" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/internal-dns" ><span class="devsite-nav-text" tooltip>Overview of internal DNS</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/networking/using-internal-dns" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/networking/using-internal-dns" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/networking/using-internal-dns" ><span class="devsite-nav-text" tooltip>Access VMs using internal DNS names</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/networking/zonal-dns" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/networking/zonal-dns" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/networking/zonal-dns" ><span class="devsite-nav-text" tooltip>Use zonal DNS</span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/compute/docs/instances/create-ptr-record" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/create-ptr-record" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/create-ptr-record" ><span class="devsite-nav-text" tooltip>Create a PTR record for a VM</span></a></li> <li class="devsite-nav-item"><a href="/compute/docs/instances/verifying-instance-identity" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/verifying-instance-identity" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/verifying-instance-identity" ><span class="devsite-nav-text" tooltip>Verify VM identity</span></a></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Manage storage</span> </div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>About disks</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/disks" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks" ><span class="devsite-nav-text" tooltip>Choose a storage option</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/hyperdisks" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/hyperdisks" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/hyperdisks" ><span class="devsite-nav-text" tooltip>About Hyperdisk</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/storage-pools" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/storage-pools" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/storage-pools" ><span class="devsite-nav-text" tooltip>About Hyperdisk Storage Pools</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/persistent-disks" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/persistent-disks" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/persistent-disks" ><span class="devsite-nav-text" tooltip>About Persistent Disk</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/extreme-persistent-disk" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/extreme-persistent-disk" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/extreme-persistent-disk" ><span class="devsite-nav-text" tooltip>Extreme Persistent Disk</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/local-ssd" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/local-ssd" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/local-ssd" ><span class="devsite-nav-text" tooltip>About Local SSD disks</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Configure storage pools</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/disks/create-storage-pools" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/create-storage-pools" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/create-storage-pools" ><span class="devsite-nav-text" tooltip>Create a storage pool</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/manage-storage-pools" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/manage-storage-pools" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/manage-storage-pools" ><span class="devsite-nav-text" tooltip>Manage storage pools</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Configure disks</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Add disks to VMs</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/disks/use-storage-pool-capacity" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/use-storage-pool-capacity" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/use-storage-pool-capacity" ><span class="devsite-nav-text" tooltip>Add disks from a storage pool to VMs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/add-local-ssd" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/add-local-ssd" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/add-local-ssd" ><span class="devsite-nav-text" tooltip>Create a VM with Local SSD disks</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/add-hyperdisk" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/add-hyperdisk" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/add-hyperdisk" ><span class="devsite-nav-text" tooltip>Create a new Hyperdisk</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/add-persistent-disk" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/add-persistent-disk" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/add-persistent-disk" ><span class="devsite-nav-text" tooltip>Create a new Persistent Disk</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/sharing-disks-between-vms" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/sharing-disks-between-vms" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/sharing-disks-between-vms" ><span class="devsite-nav-text" tooltip>Share a disk between VMs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/attach-disks" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/attach-disks" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/attach-disks" ><span class="devsite-nav-text" tooltip>Attach a disk to a VM</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/mount-ram-disks" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/mount-ram-disks" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/mount-ram-disks" ><span class="devsite-nav-text" tooltip>Mount in-memory RAM disks</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Prepare disks for use</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/disks/format-mount-disk-linux" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/format-mount-disk-linux" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/format-mount-disk-linux" ><span class="devsite-nav-text" tooltip>Format and mount a non-boot disk on Linux</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/format-mount-disk-windows" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/format-mount-disk-windows" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/format-mount-disk-windows" ><span class="devsite-nav-text" tooltip>Format and prepare a non-boot disk on Windows</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Access disks attached to a VM</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/disks/set-persistent-device-name-in-linux-vm" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/set-persistent-device-name-in-linux-vm" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/set-persistent-device-name-in-linux-vm" ><span class="devsite-nav-text" tooltip>Best practice: Use persistent device names</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/disk-symlinks" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/disk-symlinks" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/disk-symlinks" ><span class="devsite-nav-text" tooltip>Symbolic links to disks</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Transfer data to disks attached to a VM</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/transfer-files" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/transfer-files" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/transfer-files" ><span class="devsite-nav-text" tooltip>Transfer files to Linux VMs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/transfer-files-windows" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/transfer-files-windows" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/transfer-files-windows" ><span class="devsite-nav-text" tooltip>Transfer files to Windows VMs</span></a></li></ul></div></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Encrypt disks</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/disks/disk-encryption" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/disk-encryption" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/disk-encryption" ><span class="devsite-nav-text" tooltip>About disk encryption</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/customer-supplied-encryption" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/customer-supplied-encryption" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/customer-supplied-encryption" ><span class="devsite-nav-text" tooltip>Encrypt disks with customer-supplied encryption keys</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/customer-managed-encryption" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/customer-managed-encryption" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/customer-managed-encryption" ><span class="devsite-nav-text" tooltip>Help protect resources by using Cloud KMS keys</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Modify disks</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/disks/modify-hyperdisks" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/modify-hyperdisks" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/modify-hyperdisks" ><span class="devsite-nav-text" tooltip>Modify Hyperdisk</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/migrate-to-hyperdisk" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/migrate-to-hyperdisk" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/migrate-to-hyperdisk" ><span class="devsite-nav-text" tooltip>Change the disk type</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/resize-persistent-disk" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/resize-persistent-disk" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/resize-persistent-disk" ><span class="devsite-nav-text" tooltip>Increase the size of a Persistent Disk</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/modify-persistent-disk" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/modify-persistent-disk" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/modify-persistent-disk" ><span class="devsite-nav-text" tooltip>Modify a Persistent Disk</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Evaluate disk performance</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/disks/performance" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/performance" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/performance" ><span class="devsite-nav-text" tooltip>Configure disks to meet performance requirements</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Review disk performance</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/disks/review-storage-pool-metrics" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/review-storage-pool-metrics" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/review-storage-pool-metrics" ><span class="devsite-nav-text" tooltip>Review storage pool metrics</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/review-disk-metrics" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/review-disk-metrics" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/review-disk-metrics" ><span class="devsite-nav-text" tooltip>Review disk performance metrics</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/analyze-iops-hyperdisk" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/analyze-iops-hyperdisk" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/analyze-iops-hyperdisk" ><span class="devsite-nav-text" tooltip>Analyze provisioned IOPS and throughput</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Benchmark disk performance</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/disks/benchmark-hyperdisk-performance" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/benchmark-hyperdisk-performance" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/benchmark-hyperdisk-performance" ><span class="devsite-nav-text" tooltip>Benchmark Hyperdisk performance</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/benchmarking-pd-performance-linux" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/benchmarking-pd-performance-linux" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/benchmarking-pd-performance-linux" ><span class="devsite-nav-text" tooltip>Benchmark Persistent Disk performance on a Linux VM</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/benchmarking-pd-performance-windows" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/benchmarking-pd-performance-windows" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/benchmarking-pd-performance-windows" ><span class="devsite-nav-text" tooltip>Benchmark Persistent Disk performance on a Windows VM</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/benchmarking-local-ssd-performance" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/benchmarking-local-ssd-performance" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/benchmarking-local-ssd-performance" ><span class="devsite-nav-text" tooltip>Benchmark Local SSD performance</span></a></li></ul></div></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Make disks highly available</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Persistent Disk Asynchronous Replication</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/disks/async-pd/about" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/async-pd/about" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/async-pd/about" ><span class="devsite-nav-text" tooltip>About Persistent Disk Asynchronous Replication</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/async-pd/configure" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/async-pd/configure" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/async-pd/configure" ><span class="devsite-nav-text" tooltip>Configure replication</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/async-pd/manage-replication" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/async-pd/manage-replication" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/async-pd/manage-replication" ><span class="devsite-nav-text" tooltip>Manage replication</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/async-pd/failover-failback" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/async-pd/failover-failback" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/async-pd/failover-failback" ><span class="devsite-nav-text" tooltip>Failover and failback disks</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/async-pd/manage-async-disks" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/async-pd/manage-async-disks" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/async-pd/manage-async-disks" ><span class="devsite-nav-text" tooltip>Manage asynchronous disks</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/async-pd/manage-consistency-groups" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/async-pd/manage-consistency-groups" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/async-pd/manage-consistency-groups" ><span class="devsite-nav-text" tooltip>Manage consistency groups</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/async-pd/performance" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/async-pd/performance" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/async-pd/performance" ><span class="devsite-nav-text" tooltip>Review performance metrics</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Cross-zonal synchronous disk replication</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/disks/about-regional-persistent-disk" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/about-regional-persistent-disk" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/about-regional-persistent-disk" ><span class="devsite-nav-text" tooltip>About synchronous disk replication</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/high-availability-regional-persistent-disk" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/high-availability-regional-persistent-disk" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/high-availability-regional-persistent-disk" ><span class="devsite-nav-text" tooltip>Build high availability services using synchronous disk replication</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/regional-persistent-disk" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/regional-persistent-disk" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/regional-persistent-disk" ><span class="devsite-nav-text" tooltip>Create and manage synchronously replicated disks</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/repd-failover" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/repd-failover" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/repd-failover" ><span class="devsite-nav-text" tooltip>Manage failures for synchronous disk replication</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/design-considerations-for-resilient-workloads-with-regional-persistent-disks" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/design-considerations-for-resilient-workloads-with-regional-persistent-disks" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/design-considerations-for-resilient-workloads-with-regional-persistent-disks" ><span class="devsite-nav-text" tooltip>Design considerations for resilient workloads with replicated disks</span></a></li></ul></div></li></ul></div></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Back up and restore</span> </div></li> <li class="devsite-nav-item"><a href="/compute/docs/disks/data-protection" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/data-protection" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/data-protection" ><span class="devsite-nav-text" tooltip>Data protection options</span></a></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Back up VMs</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/machine-images" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/machine-images" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/machine-images" ><span class="devsite-nav-text" tooltip>Machine images</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/machine-images/create-machine-images" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/machine-images/create-machine-images" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/machine-images/create-machine-images" ><span class="devsite-nav-text" tooltip>Create machine images</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/machine-images/import-machine-from-virtual-appliance" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/machine-images/import-machine-from-virtual-appliance" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/machine-images/import-machine-from-virtual-appliance" ><span class="devsite-nav-text" tooltip>Import machine images from virtual appliances</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Back up disks</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Back up a disk in place</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/disks/instant-snapshots" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/instant-snapshots" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/instant-snapshots" ><span class="devsite-nav-text" tooltip>About instant snapshots</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/create-instant-snapshots" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/create-instant-snapshots" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/create-instant-snapshots" ><span class="devsite-nav-text" tooltip>Create and manage instant snapshots</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/convert-instant-snapshot" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/convert-instant-snapshot" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/convert-instant-snapshot" ><span class="devsite-nav-text" tooltip>Copy an instant snapshot to a different location</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Back up a disk for disaster recovery</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/disks/snapshots" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/snapshots" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/snapshots" ><span class="devsite-nav-text" tooltip>About disk snapshots</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/snapshot-best-practices" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/snapshot-best-practices" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/snapshot-best-practices" ><span class="devsite-nav-text" tooltip>Best practices for disk snapshots</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/snapshot-settings" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/snapshot-settings" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/snapshot-settings" ><span class="devsite-nav-text" tooltip>Set default storage location using snapshot settings</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/create-snapshots" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/create-snapshots" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/create-snapshots" ><span class="devsite-nav-text" tooltip>Create disk snapshots</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/manage-snapshots" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/manage-snapshots" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/manage-snapshots" ><span class="devsite-nav-text" tooltip>Manage disk snapshots</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Create application consistent snapshots</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/disks/creating-linux-application-consistent-pd-snapshots" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/creating-linux-application-consistent-pd-snapshots" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/creating-linux-application-consistent-pd-snapshots" ><span class="devsite-nav-text" tooltip>Create Linux application consistent snapshots</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/windows/creating-windows-persistent-disk-snapshot" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/windows/creating-windows-persistent-disk-snapshot" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/windows/creating-windows-persistent-disk-snapshot" ><span class="devsite-nav-text" tooltip>Create a Windows disk snapshot (VSS snapshots)</span></a></li></ul></div></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Schedule disk backups</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/disks/about-snapshot-schedules" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/about-snapshot-schedules" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/about-snapshot-schedules" ><span class="devsite-nav-text" tooltip>About snapshot schedules</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/scheduled-snapshots" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/scheduled-snapshots" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/scheduled-snapshots" ><span class="devsite-nav-text" tooltip>Create snapshot schedules</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/manage-snapshot-schedules" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/manage-snapshot-schedules" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/manage-snapshot-schedules" ><span class="devsite-nav-text" tooltip>Manage snapshot schedules</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/create-alert-snapshot-schedule" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/create-alert-snapshot-schedule" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/create-alert-snapshot-schedule" ><span class="devsite-nav-text" tooltip>Configure alerts for snapshot schedules</span></a></li></ul></div></li><li class="devsite-nav-item"><a href="/compute/docs/disks/clone-duplicate-disks" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/clone-duplicate-disks" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/clone-duplicate-disks" ><span class="devsite-nav-text" tooltip>Duplicate a disk with clones</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Restore from a backup</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/machine-images/create-instance-from-machine-image" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/machine-images/create-instance-from-machine-image" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/machine-images/create-instance-from-machine-image" ><span class="devsite-nav-text" tooltip>Create VMs from machine images</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/restore-snapshot" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/restore-snapshot" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/restore-snapshot" ><span class="devsite-nav-text" tooltip>Restore from a standard snapshot</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/restore-instant-snapshot" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/restore-instant-snapshot" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/restore-instant-snapshot" ><span class="devsite-nav-text" tooltip>Restore from an instant snapshot</span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/compute/docs/disks/recover-vm" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/recover-vm" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/recover-vm" ><span class="devsite-nav-text" tooltip>Recover a VM with a corrupted or full disk</span></a></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Manage VMs</span> </div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Basic operations and lifecycle</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/instance-life-cycle" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/instance-life-cycle" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/instance-life-cycle" ><span class="devsite-nav-text" tooltip>VM instance lifecycle</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/stop-start-instance" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/stop-start-instance" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/stop-start-instance" ><span class="devsite-nav-text" tooltip>Stop or restart a VM</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/suspend-resume-instance" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/suspend-resume-instance" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/suspend-resume-instance" ><span class="devsite-nav-text" tooltip>Suspend or resume a VM</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Schedule VM operations</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/schedule-instance-start-stop" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/schedule-instance-start-stop" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/schedule-instance-start-stop" ><span class="devsite-nav-text" tooltip>Schedule a VM to start and stop</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/limit-vm-runtime" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/limit-vm-runtime" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/limit-vm-runtime" ><span class="devsite-nav-text" tooltip>Limit the run time of a VM</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>View VM properties</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/detect-compute-engine" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/detect-compute-engine" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/detect-compute-engine" ><span class="devsite-nav-text" tooltip>Detect if a VM is running in Compute Engine</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/get-list" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/get-list" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/get-list" ><span class="devsite-nav-text" tooltip>Get a list of VMs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/view-vm-details" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/view-vm-details" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/view-vm-details" ><span class="devsite-nav-text" tooltip>Get the details of a VM</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/get-uuid" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/get-uuid" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/get-uuid" ><span class="devsite-nav-text" tooltip>Get the UUID of a VM</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/view-vm-image" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/view-vm-image" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/view-vm-image" ><span class="devsite-nav-text" tooltip>View the source image of a VM</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/view-references-between-resources" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/view-references-between-resources" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/view-references-between-resources" ><span class="devsite-nav-text" tooltip>View referrers to VMs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/view-ip-address" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/view-ip-address" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/view-ip-address" ><span class="devsite-nav-text" tooltip>Locate IP addresses for a VM</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/view-visible-cores" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/view-visible-cores" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/view-visible-cores" ><span class="devsite-nav-text" tooltip>View the number of visible CPU cores</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Update VM details</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/rename-instance" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/rename-instance" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/rename-instance" ><span class="devsite-nav-text" tooltip>Rename a VM</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/update-instance-properties" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/update-instance-properties" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/update-instance-properties" ><span class="devsite-nav-text" tooltip>Update VM properties</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/changing-machine-type-of-stopped-instance" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/changing-machine-type-of-stopped-instance" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/changing-machine-type-of-stopped-instance" ><span class="devsite-nav-text" tooltip>Edit the machine type of a VM</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/gpus/add-remove-gpus" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/gpus/add-remove-gpus" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/gpus/add-remove-gpus" ><span class="devsite-nav-text" tooltip>Add or remove GPUs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/change-service-account" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/change-service-account" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/change-service-account" ><span class="devsite-nav-text" tooltip>Change the attached service account</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Update the physical location of a VM</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/placement-policies-overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/placement-policies-overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/placement-policies-overview" ><span class="devsite-nav-text" tooltip>About placement policies</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/use-spread-placement-policies" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/use-spread-placement-policies" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/use-spread-placement-policies" ><span class="devsite-nav-text" tooltip>Create and apply spread placement policies to VMs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/view-placement-policies" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/view-placement-policies" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/view-placement-policies" ><span class="devsite-nav-text" tooltip>View placement policies</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/manage-placement-policies" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/manage-placement-policies" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/manage-placement-policies" ><span class="devsite-nav-text" tooltip>Remove or delete placement policies</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Configure IP addresses</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/ip-addresses/configure-static-external-ip-address" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/ip-addresses/configure-static-external-ip-address" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/ip-addresses/configure-static-external-ip-address" ><span class="devsite-nav-text" tooltip>Configure static external IP addresses</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/ip-addresses/configure-static-internal-ip-address" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/ip-addresses/configure-static-internal-ip-address" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/ip-addresses/configure-static-internal-ip-address" ><span class="devsite-nav-text" tooltip>Configure static internal IP addresses</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/ip-addresses/configure-ipv6-address" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/ip-addresses/configure-ipv6-address" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/ip-addresses/configure-ipv6-address" ><span class="devsite-nav-text" tooltip>Configure IPv6 for instances and instance templates</span></a></li></ul></div></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Delete VMs</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/deleting-instance" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/deleting-instance" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/deleting-instance" ><span class="devsite-nav-text" tooltip>Delete a VM</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/preventing-accidental-vm-deletion" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/preventing-accidental-vm-deletion" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/preventing-accidental-vm-deletion" ><span class="devsite-nav-text" tooltip>Prevent accidental VM deletion</span></a></li></ul></div></li></ul></div></li> <li class="devsite-nav-item"><a href="/compute/docs/nodes/updating-vm-tenancy" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/nodes/updating-vm-tenancy" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/nodes/updating-vm-tenancy" ><span class="devsite-nav-text" tooltip>Update VM tenancy</span></a></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Manage groups of VMs</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/working-with-managed-instances" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/working-with-managed-instances" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/working-with-managed-instances" ><span class="devsite-nav-text" tooltip>Work with managed VMs in a MIG</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/getting-info-about-migs" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/getting-info-about-migs" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/getting-info-about-migs" ><span class="devsite-nav-text" tooltip>View info about MIGs and managed instances</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/add-remove-vms-in-mig" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/add-remove-vms-in-mig" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/add-remove-vms-in-mig" ><span class="devsite-nav-text" tooltip>Add or remove VMs in a MIG</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/limit-vm-runtime-in-migs" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/limit-vm-runtime-in-migs" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/limit-vm-runtime-in-migs" ><span class="devsite-nav-text" tooltip>Limit the run time of VMs in a MIG</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Add GPU VMs all at once in a MIG</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/about-resize-requests-mig" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/about-resize-requests-mig" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/about-resize-requests-mig" ><span class="devsite-nav-text" tooltip>About resize requests</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/create-resize-requests-mig" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/create-resize-requests-mig" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/create-resize-requests-mig" ><span class="devsite-nav-text" tooltip>Create resize requests</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/manage-resize-requests-mig" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/manage-resize-requests-mig" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/manage-resize-requests-mig" ><span class="devsite-nav-text" tooltip>View, cancel, or delete resize requests</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable devsite-nav-preview"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Configure instance flexibility in a MIG</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/about-instance-flexibility" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/about-instance-flexibility" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/about-instance-flexibility" ><span class="devsite-nav-text" tooltip>About instance flexibility</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/configure-instance-flexibility" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/configure-instance-flexibility" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/configure-instance-flexibility" ><span class="devsite-nav-text" tooltip>Add instance flexibility</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/view-instance-flexibility-configuration" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/view-instance-flexibility-configuration" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/view-instance-flexibility-configuration" ><span class="devsite-nav-text" tooltip>View instance flexibility configuration</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/change-or-remove-instance-flexibility-configuration" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/change-or-remove-instance-flexibility-configuration" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/change-or-remove-instance-flexibility-configuration" ><span class="devsite-nav-text" tooltip>Change or remove instance flexibility</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Distribute VMs across zones in a regional MIG</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/regional-migs" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/regional-migs" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/regional-migs" ><span class="devsite-nav-text" tooltip>About regional MIGs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/regional-mig-distribution-shape" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/regional-mig-distribution-shape" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/regional-mig-distribution-shape" ><span class="devsite-nav-text" tooltip>About target distribution shape</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/regional-mig-set-target-distribution-shape" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/regional-mig-set-target-distribution-shape" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/regional-mig-set-target-distribution-shape" ><span class="devsite-nav-text" tooltip>Set a target distribution for VMs across zones</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/regional-mig-enable-disable-proactive-redistribution" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/regional-mig-enable-disable-proactive-redistribution" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/regional-mig-enable-disable-proactive-redistribution" ><span class="devsite-nav-text" tooltip>Disable and reenable proactive instance redistribution</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/regional-mig-rebalance-manually" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/regional-mig-rebalance-manually" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/regional-mig-rebalance-manually" ><span class="devsite-nav-text" tooltip>Manually rebalance a regional MIG</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/regional-mig-simulate-zonal-outage" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/regional-mig-simulate-zonal-outage" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/regional-mig-simulate-zonal-outage" ><span class="devsite-nav-text" tooltip>Simulate a zone outage for a regional MIG</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Work with suspended and stopped VMs in a MIG</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-preview"><a href="/compute/docs/instance-groups/suspended-and-stopped-vms-in-mig" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/suspended-and-stopped-vms-in-mig" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/suspended-and-stopped-vms-in-mig" ><span class="devsite-nav-text" tooltip>Overview</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-preview"><a href="/compute/docs/instance-groups/manually-suspend-or-stop-vms-in-mig" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/manually-suspend-or-stop-vms-in-mig" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/manually-suspend-or-stop-vms-in-mig" ><span class="devsite-nav-text" tooltip>Manually suspend or stop VMs in a MIG</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-preview"><a href="/compute/docs/instance-groups/accelerate-mig-scale-out-with-standby-pools" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/accelerate-mig-scale-out-with-standby-pools" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/accelerate-mig-scale-out-with-standby-pools" ><span class="devsite-nav-text" tooltip>Accelerate scale out with suspended and stopped VMs</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Apply new VM configurations in a MIG</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/updating-migs" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/updating-migs" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/updating-migs" ><span class="devsite-nav-text" tooltip>About applying new VM configurations to VMs in a MIG</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/rolling-out-updates-to-managed-instance-groups" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/rolling-out-updates-to-managed-instance-groups" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/rolling-out-updates-to-managed-instance-groups" ><span class="devsite-nav-text" tooltip>Automatically apply VM configuration updates</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/updating-selected-instances-in-a-mig" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/updating-selected-instances-in-a-mig" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/updating-selected-instances-in-a-mig" ><span class="devsite-nav-text" tooltip>Selectively apply VM configuration updates</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/update-on-repair" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/update-on-repair" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/update-on-repair" ><span class="devsite-nav-text" tooltip>Apply configuration updates during repairs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/set-mig-aic" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/set-mig-aic" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/set-mig-aic" ><span class="devsite-nav-text" tooltip>Override instance template properties with an all-instances configuration</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/upgrading-images-in-migs" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/upgrading-images-in-migs" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/upgrading-images-in-migs" ><span class="devsite-nav-text" tooltip>Perform one-click OS image upgrades</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Maintain high availability during VM failures</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/about-repair" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/about-repair" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/about-repair" ><span class="devsite-nav-text" tooltip>About repairing VMs for high availability</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Repair a VM when an application fails</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/autohealing-instances-in-migs" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/autohealing-instances-in-migs" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/autohealing-instances-in-migs" ><span class="devsite-nav-text" tooltip>Set up an application-based health check and autohealing</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/monitoring-managed-instance-health-state-changes" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/monitoring-managed-instance-health-state-changes" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/monitoring-managed-instance-health-state-changes" ><span class="devsite-nav-text" tooltip>Monitor VM health state changes</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/disabling-and-enabling-health-state-change-logs" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/disabling-and-enabling-health-state-change-logs" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/disabling-and-enabling-health-state-change-logs" ><span class="devsite-nav-text" tooltip>Disable and enable health state change logs</span></a></li></ul></div></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/turn-off-vm-repairs-in-mig" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/turn-off-vm-repairs-in-mig" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/turn-off-vm-repairs-in-mig" ><span class="devsite-nav-text" tooltip>Turn off repairs in a MIG</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Support a stateful workload with a MIG</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/stateful-migs" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/stateful-migs" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/stateful-migs" ><span class="devsite-nav-text" tooltip>About stateful MIGs</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Configure stateful MIGs</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/configuring-stateful-migs" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/configuring-stateful-migs" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/configuring-stateful-migs" ><span class="devsite-nav-text" tooltip>Configure a stateful MIG</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/configuring-stateful-disks-in-migs" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/configuring-stateful-disks-in-migs" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/configuring-stateful-disks-in-migs" ><span class="devsite-nav-text" tooltip>Configure stateful persistent disks</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/configuring-stateful-metadata-in-migs" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/configuring-stateful-metadata-in-migs" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/configuring-stateful-metadata-in-migs" ><span class="devsite-nav-text" tooltip>Configure stateful metadata</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/configuring-stateful-ip-addresses-in-migs" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/configuring-stateful-ip-addresses-in-migs" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/configuring-stateful-ip-addresses-in-migs" ><span class="devsite-nav-text" tooltip>Configure stateful IP addresses</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/applying-viewing-removing-stateful-config-in-migs" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/applying-viewing-removing-stateful-config-in-migs" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/applying-viewing-removing-stateful-config-in-migs" ><span class="devsite-nav-text" tooltip>Apply, view, and remove stateful configuration</span></a></li></ul></div></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/how-stateful-migs-work" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/how-stateful-migs-work" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/how-stateful-migs-work" ><span class="devsite-nav-text" tooltip>How stateful MIGs work</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/preserved-state" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/preserved-state" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/preserved-state" ><span class="devsite-nav-text" tooltip>How operations affect preserved state</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Group VMs together</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/tutorials/migrate-workload-to-stateful-mig" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/tutorials/migrate-workload-to-stateful-mig" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/tutorials/migrate-workload-to-stateful-mig" ><span class="devsite-nav-text" tooltip>Migrate an existing workload to a stateful managed instance group</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/creating-groups-of-unmanaged-instances" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/creating-groups-of-unmanaged-instances" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/creating-groups-of-unmanaged-instances" ><span class="devsite-nav-text" tooltip>Group unmanaged VMs together</span></a></li></ul></div></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/delete-mig" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/delete-mig" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/delete-mig" ><span class="devsite-nav-text" tooltip>Delete a MIG</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Host maintenance events</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/host-maintenance-overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/host-maintenance-overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/host-maintenance-overview" ><span class="devsite-nav-text" tooltip>About host events</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/live-migration-process" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/live-migration-process" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/live-migration-process" ><span class="devsite-nav-text" tooltip>Live migration process</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/setting-vm-host-options" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/setting-vm-host-options" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/setting-vm-host-options" ><span class="devsite-nav-text" tooltip>Set the host maintenance policy</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/metadata/getting-live-migration-notice" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/metadata/getting-live-migration-notice" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/metadata/getting-live-migration-notice" ><span class="devsite-nav-text" tooltip>Query metadata server for notices</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/simulating-host-maintenance" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/simulating-host-maintenance" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/simulating-host-maintenance" ><span class="devsite-nav-text" tooltip>Simulate a host maintenance event</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/gpus/gpu-host-maintenance" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/gpus/gpu-host-maintenance" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/gpus/gpu-host-maintenance" ><span class="devsite-nav-text" tooltip>Handle GPU host maintenance events</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/monitor-plan-host-maintenance-event" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/monitor-plan-host-maintenance-event" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/monitor-plan-host-maintenance-event" ><span class="devsite-nav-text" tooltip>Monitor and plan for a host maintenance event</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/trigger-host-maintenance-event" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/trigger-host-maintenance-event" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/trigger-host-maintenance-event" ><span class="devsite-nav-text" tooltip>Manually start host maintenance</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Manage metadata</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/metadata/overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/metadata/overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/metadata/overview" ><span class="devsite-nav-text" tooltip>About VM metadata</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/metadata/predefined-metadata-keys" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/metadata/predefined-metadata-keys" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/metadata/predefined-metadata-keys" ><span class="devsite-nav-text" tooltip>Predefined metadata keys</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/metadata/setting-custom-metadata" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/metadata/setting-custom-metadata" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/metadata/setting-custom-metadata" ><span class="devsite-nav-text" tooltip>Set and remove custom metadata</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/metadata/querying-metadata" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/metadata/querying-metadata" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/metadata/querying-metadata" ><span class="devsite-nav-text" tooltip>View and query VM metadata</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/metadata/manage-guest-attributes" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/metadata/manage-guest-attributes" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/metadata/manage-guest-attributes" ><span class="devsite-nav-text" tooltip>Set and query guest attributes</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Securing VMs</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/about-shielded-vm" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/about-shielded-vm" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/about-shielded-vm" ><span class="devsite-nav-text" tooltip>About Shielded VMs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/about-confidential-vm" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/about-confidential-vm" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/about-confidential-vm" ><span class="devsite-nav-text" tooltip>About Confidential VMs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/protecting-resources-vpc-service-controls" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/protecting-resources-vpc-service-controls" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/protecting-resources-vpc-service-controls" ><span class="devsite-nav-text" tooltip>Protect resources with VPC Service Controls</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Manage operating systems</span> </div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Guest environment</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/images/guest-environment" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/images/guest-environment" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/images/guest-environment" ><span class="devsite-nav-text" tooltip>About the guest environment</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/images/install-guest-environment" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/images/install-guest-environment" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/images/install-guest-environment" ><span class="devsite-nav-text" tooltip>Install the guest environment</span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/compute/docs/vm-manager" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/vm-manager" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/vm-manager" ><span class="devsite-nav-text" tooltip>Manage operating systems using VM Manager</span></a></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Manage OS images</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/images/image-management-best-practices" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/images/image-management-best-practices" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/images/image-management-best-practices" ><span class="devsite-nav-text" tooltip>Image management best practices</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/images/image-families-best-practices" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/images/image-families-best-practices" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/images/image-families-best-practices" ><span class="devsite-nav-text" tooltip>Image families best practices</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/images/premium/access-rhel-knowledgebase" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/images/premium/access-rhel-knowledgebase" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/images/premium/access-rhel-knowledgebase" ><span class="devsite-nav-text" tooltip>Access Red Hat Knowledgebase</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/images/managing-access-custom-images" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/images/managing-access-custom-images" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/images/managing-access-custom-images" ><span class="devsite-nav-text" tooltip>Manage access to custom images</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/images/restricting-image-access" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/images/restricting-image-access" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/images/restricting-image-access" ><span class="devsite-nav-text" tooltip>Set up trusted image policies</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/images/export-image" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/images/export-image" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/images/export-image" ><span class="devsite-nav-text" tooltip>Export a custom image to Cloud Storage</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/images/set-version-custom" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/images/set-version-custom" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/images/set-version-custom" ><span class="devsite-nav-text" tooltip>Set image versions in an image family</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/images/deprecate-custom" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/images/deprecate-custom" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/images/deprecate-custom" ><span class="devsite-nav-text" tooltip>Deprecate a custom image</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/images/delete-custom" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/images/delete-custom" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/images/delete-custom" ><span class="devsite-nav-text" tooltip>Delete a custom image</span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/compute/docs/instances/artifact-registry-os-packages" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/artifact-registry-os-packages" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/artifact-registry-os-packages" ><span class="devsite-nav-text" tooltip>Manage OS packages</span></a></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Manage licenses</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/licenses/about" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/licenses/about" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/licenses/about" ><span class="devsite-nav-text" tooltip>About licenses</span></a></li><li class="devsite-nav-item devsite-nav-preview"><a href="/compute/docs/licenses/view-append" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/licenses/view-append" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/licenses/view-append" ><span class="devsite-nav-text" tooltip>View and append licenses</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-preview"><a href="/compute/docs/images/premium/rhel/appending-els-licenses" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/images/premium/rhel/appending-els-licenses" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/images/premium/rhel/appending-els-licenses" ><span class="devsite-nav-text" tooltip>Append RHEL ELS licenses</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span></a></li><li class="devsite-nav-item devsite-nav-preview"><a href="/compute/docs/images/premium/ubuntu-pro/upgrade-from-ubuntu" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/images/premium/ubuntu-pro/upgrade-from-ubuntu" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/images/premium/ubuntu-pro/upgrade-from-ubuntu" ><span class="devsite-nav-text" tooltip>Upgrade from Ubuntu to Ubuntu Pro</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Use startup scripts</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/startup-scripts" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/startup-scripts" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/startup-scripts" ><span class="devsite-nav-text" tooltip>Startup scripts overview</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/startup-scripts/linux" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/startup-scripts/linux" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/startup-scripts/linux" ><span class="devsite-nav-text" tooltip>Use startup scripts on Linux VMs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/startup-scripts/windows" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/startup-scripts/windows" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/startup-scripts/windows" ><span class="devsite-nav-text" tooltip>Use startup scripts on Windows VMs</span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/compute/docs/shutdownscript" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/shutdownscript" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/shutdownscript" ><span class="devsite-nav-text" tooltip>Run shutdown scripts</span></a></li> <li class="devsite-nav-item"><a href="/compute/docs/instances/configure-ntp" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/configure-ntp" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/configure-ntp" ><span class="devsite-nav-text" tooltip>Configure NTP</span></a></li> <li class="devsite-nav-item"><a href="/compute/docs/instances/enabling-virtio-rng" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/enabling-virtio-rng" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/enabling-virtio-rng" ><span class="devsite-nav-text" tooltip>Enable the virtual random number generator (Virtio RNG)</span></a></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Deploy workloads</span> </div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Set up authentication for workloads</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/access/app-authentication-methods" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/access/app-authentication-methods" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/access/app-authentication-methods" ><span class="devsite-nav-text" tooltip>Choose a workload authentication method</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/access/authenticate-workloads" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/access/authenticate-workloads" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/access/authenticate-workloads" ><span class="devsite-nav-text" tooltip>Authenticate workloads to Google Cloud API using service accounts</span></a></li><li class="devsite-nav-item devsite-nav-preview"><a href="/compute/docs/access/authenticate-workloads-over-mtls" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/access/authenticate-workloads-over-mtls" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/access/authenticate-workloads-over-mtls" ><span class="devsite-nav-text" tooltip>Authenticate workloads to other workloads over mTLS</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Web servers</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/tutorials/basic-webserver-apache" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/tutorials/basic-webserver-apache" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/tutorials/basic-webserver-apache" ><span class="devsite-nav-text" tooltip>Deploy an Apache server</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/tutorials/basic-webserver-iis" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/tutorials/basic-webserver-iis" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/tutorials/basic-webserver-iis" ><span class="devsite-nav-text" tooltip>Deploy an IIS server</span></a></li><li class="devsite-nav-item"><a href="/docs/terraform/get-started-with-terraform" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /docs/terraform/get-started-with-terraform" track-type="bookNav" track-name="click" track-metadata-eventdetail="/docs/terraform/get-started-with-terraform" ><span class="devsite-nav-text" tooltip>Deploy a Flask server by using Terraform</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Applications</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="https://console.cloud.google.com/getting-started?walkthrough_tutorial_id=compute_quickstart" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: https://console.cloud.google.com/getting-started?walkthrough_tutorial_id=compute_quickstart" track-type="bookNav" track-name="click" track-metadata-eventdetail="https://console.cloud.google.com/getting-started?walkthrough_tutorial_id=compute_quickstart" ><span class="devsite-nav-text" tooltip>Interactive: Build a to-do app with MongoDB</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/tutorials/deploy-aspnet-app" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/tutorials/deploy-aspnet-app" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/tutorials/deploy-aspnet-app" ><span class="devsite-nav-text" tooltip>Deploy an ASP.NET application</span></a></li><li class="devsite-nav-item"><a href="/community/tutorials/joomla-on-compute-engine" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /community/tutorials/joomla-on-compute-engine" track-type="bookNav" track-name="click" track-metadata-eventdetail="/community/tutorials/joomla-on-compute-engine" ><span class="devsite-nav-text" tooltip>Set up Joomla</span></a></li><li class="devsite-nav-item"><a href="/community/tutorials/setting-up-lamp" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /community/tutorials/setting-up-lamp" track-type="bookNav" track-name="click" track-metadata-eventdetail="/community/tutorials/setting-up-lamp" ><span class="devsite-nav-text" tooltip>Set up LAMP</span></a></li><li class="devsite-nav-item"><a href="/build/docs/deploying-builds/deploy-compute-engine" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/docs/deploying-builds/deploy-compute-engine" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/docs/deploying-builds/deploy-compute-engine" ><span class="devsite-nav-text" tooltip>Perform blue/green deployments using Cloud Build</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Send email from a VM</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/tutorials/sending-mail" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/tutorials/sending-mail" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/tutorials/sending-mail" ><span class="devsite-nav-text" tooltip>About sending email</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/tutorials/sending-mail/using-sendgrid" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/tutorials/sending-mail/using-sendgrid" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/tutorials/sending-mail/using-sendgrid" ><span class="devsite-nav-text" tooltip>Send email with SendGrid</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/tutorials/sending-mail/using-mailgun" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/tutorials/sending-mail/using-mailgun" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/tutorials/sending-mail/using-mailgun" ><span class="devsite-nav-text" tooltip>Send email with Mailgun</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/tutorials/sending-mail/using-mailjet" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/tutorials/sending-mail/using-mailjet" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/tutorials/sending-mail/using-mailjet" ><span class="devsite-nav-text" tooltip>Send email with Mailjet</span></a></li></ul></div></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Databases</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>MySQL</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/sql-server/setup-mysql" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/sql-server/setup-mysql" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/sql-server/setup-mysql" ><span class="devsite-nav-text" tooltip>Set up MySQL on Compute Engine</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/sql-server/mysql-remote-access" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/sql-server/mysql-remote-access" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/sql-server/mysql-remote-access" ><span class="devsite-nav-text" tooltip>Set up client access with a private IP address</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/sql-server/cloning-a-mysql-database-on-compute-engine" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/sql-server/cloning-a-mysql-database-on-compute-engine" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/sql-server/cloning-a-mysql-database-on-compute-engine" ><span class="devsite-nav-text" tooltip>Cloning a MySQL database on Compute Engine</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/sql-server/deploying-highly-available-mysql-cluster-with-drbd-on-compute-engine" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/sql-server/deploying-highly-available-mysql-cluster-with-drbd-on-compute-engine" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/sql-server/deploying-highly-available-mysql-cluster-with-drbd-on-compute-engine" ><span class="devsite-nav-text" tooltip>Deploying a highly available MySQL 5.6 cluster with DRBD on Compute Engine</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>PostgreSQL</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/community/tutorials/setting-up-postgres" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /community/tutorials/setting-up-postgres" track-type="bookNav" track-name="click" track-metadata-eventdetail="/community/tutorials/setting-up-postgres" ><span class="devsite-nav-text" tooltip>Set up PostgreSQL on Compute Engine</span></a></li><li class="devsite-nav-item"><a href="/community/tutorials/setting-up-postgres-data-disk" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /community/tutorials/setting-up-postgres-data-disk" track-type="bookNav" track-name="click" track-metadata-eventdetail="/community/tutorials/setting-up-postgres-data-disk" ><span class="devsite-nav-text" tooltip>Set up a PostgreSQL data disk</span></a></li><li class="devsite-nav-item"><a href="/community/tutorials/setting-up-postgres-hot-standby" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /community/tutorials/setting-up-postgres-hot-standby" track-type="bookNav" track-name="click" track-metadata-eventdetail="/community/tutorials/setting-up-postgres-hot-standby" ><span class="devsite-nav-text" tooltip>Set up PostgreSQL with hot standby</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>SQL Server</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/sql-server/best-practices" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/sql-server/best-practices" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/sql-server/best-practices" ><span class="devsite-nav-text" tooltip>Best practices for SQL Server VMs</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Create</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/tutorials/creating-high-performance-sql-server-instance" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/tutorials/creating-high-performance-sql-server-instance" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/tutorials/creating-high-performance-sql-server-instance" ><span class="devsite-nav-text" tooltip>Create a high-performance SQL Server VM</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/sql-server/adding-sql-server-license-to-linux" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/sql-server/adding-sql-server-license-to-linux" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/sql-server/adding-sql-server-license-to-linux" ><span class="devsite-nav-text" tooltip>Add a SQL Server license to an existing Linux server</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/sql-server/adding-sql-server-license" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/sql-server/adding-sql-server-license" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/sql-server/adding-sql-server-license" ><span class="devsite-nav-text" tooltip>Add a SQL Server license to an existing Windows server</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/tutorials/creating-sql-server-instance-using-netapp" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/tutorials/creating-sql-server-instance-using-netapp" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/tutorials/creating-sql-server-instance-using-netapp" ><span class="devsite-nav-text" tooltip>Configure SQL Server on Google Cloud Platform using Cloud Volumes Service</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Configure</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/sql-server/configure-availability" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/sql-server/configure-availability" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/sql-server/configure-availability" ><span class="devsite-nav-text" tooltip>Set up AlwaysOn availability groups</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/sql-server/configure-failover-cluster-instance" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/sql-server/configure-failover-cluster-instance" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/sql-server/configure-failover-cluster-instance" ><span class="devsite-nav-text" tooltip>Set up a failover cluster VM that uses S2D</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/sql-server/configure-failover-cluster-instance-pd-multi-writer" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/sql-server/configure-failover-cluster-instance-pd-multi-writer" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/sql-server/configure-failover-cluster-instance-pd-multi-writer" ><span class="devsite-nav-text" tooltip>Set up a failover cluster VM with multi-writer persistent disks</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/tutorials/high-availability-linux-pacemaker" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/tutorials/high-availability-linux-pacemaker" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/tutorials/high-availability-linux-pacemaker" ><span class="devsite-nav-text" tooltip>Set up a SQL Server cluster on Linux with Alaways On availability groups and Pacemaker</span></a></li></ul></div></li><li class="devsite-nav-item"><a href="/compute/docs/instances/sql-server/cloning-a-microsoft-sql-server-database-on-compute-engine" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/sql-server/cloning-a-microsoft-sql-server-database-on-compute-engine" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/sql-server/cloning-a-microsoft-sql-server-database-on-compute-engine" ><span class="devsite-nav-text" tooltip>Cloning a Microsoft SQL Server database on Compute Engine</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/tutorials/load-testing-sql-server-hammerdb" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/tutorials/load-testing-sql-server-hammerdb" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/tutorials/load-testing-sql-server-hammerdb" ><span class="devsite-nav-text" tooltip>Load test SQL Server using HammerDB</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/sql-server/disaster-recovery-for-microsoft-sql-server" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/sql-server/disaster-recovery-for-microsoft-sql-server" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/sql-server/disaster-recovery-for-microsoft-sql-server" ><span class="devsite-nav-text" tooltip>Disaster recovery for Microsoft SQL Server</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/sql-server/dr-for-microsoft-sql-server-with-async-pd" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/sql-server/dr-for-microsoft-sql-server-with-async-pd" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/sql-server/dr-for-microsoft-sql-server-with-async-pd" ><span class="devsite-nav-text" tooltip>Disaster recovery for Microsoft SQL Server with Async PD</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/sql-server/deploying-microsoft-sql-server-multi-regional-disaster-recovery" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/sql-server/deploying-microsoft-sql-server-multi-regional-disaster-recovery" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/sql-server/deploying-microsoft-sql-server-multi-regional-disaster-recovery" ><span class="devsite-nav-text" tooltip>Deploying Microsoft SQL Server for multi-regional disaster recovery</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Redis</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/redis/deployment-options" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/redis/deployment-options" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/redis/deployment-options" ><span class="devsite-nav-text" tooltip>Deployment Options for Redis on Google Cloud </span></a></li></ul></div></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Containers</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/containers" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/containers" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/containers" ><span class="devsite-nav-text" tooltip>Containers on Compute Engine</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/containers/deploying-containers" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/containers/deploying-containers" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/containers/deploying-containers" ><span class="devsite-nav-text" tooltip>Deploy containers on VMs and managed instance groups</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/containers/configuring-options-to-run-containers" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/containers/configuring-options-to-run-containers" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/containers/configuring-options-to-run-containers" ><span class="devsite-nav-text" tooltip>Configure options to run your container</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Microsoft Windows</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/windows" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/windows" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/windows" ><span class="devsite-nav-text" tooltip>Windows workloads</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/windows/windows-best-practices" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/windows/windows-best-practices" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/windows/windows-best-practices" ><span class="devsite-nav-text" tooltip>Best practices for Windows Server VMs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/tutorials/setup-active-directory" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/tutorials/setup-active-directory" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/tutorials/setup-active-directory" ><span class="devsite-nav-text" tooltip>Setting up Active Directory</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/windows/best-practices" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/windows/best-practices" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/windows/best-practices" ><span class="devsite-nav-text" tooltip>Best practices for running Active Directory on Google Cloud</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/windows/deploying-microsoft-sharepoint-server-on-compute-engine" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/windows/deploying-microsoft-sharepoint-server-on-compute-engine" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/windows/deploying-microsoft-sharepoint-server-on-compute-engine" ><span class="devsite-nav-text" tooltip>Deploy Microsoft SharePoint Server on Compute Engine</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/windows/deploying-microsoft-exchange-server-2016-on-compute-engine" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/windows/deploying-microsoft-exchange-server-2016-on-compute-engine" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/windows/deploying-microsoft-exchange-server-2016-on-compute-engine" ><span class="devsite-nav-text" tooltip>Deploying Microsoft Exchange Server 2016 on Compute Engine</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Windows Server</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/tutorials/performing-in-place-upgrade-windows-server" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/tutorials/performing-in-place-upgrade-windows-server" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/tutorials/performing-in-place-upgrade-windows-server" ><span class="devsite-nav-text" tooltip>Perform an in-place upgrade of Windows Server</span></a></li><li class="devsite-nav-item devsite-nav-beta"><a href="/compute/docs/tutorials/performing-an-automated-in-place-upgrade-windows-server" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/tutorials/performing-an-automated-in-place-upgrade-windows-server" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/tutorials/performing-an-automated-in-place-upgrade-windows-server" ><span class="devsite-nav-text" tooltip>Perform an automated in-place upgrade of Windows Server</span><span class="devsite-nav-icon material-icons" data-icon="beta" data-title="Beta" aria-hidden="true"></span></a></li><li class="devsite-nav-item"><a href="/compute/docs/tutorials/running-windows-server-failover-clustering" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/tutorials/running-windows-server-failover-clustering" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/tutorials/running-windows-server-failover-clustering" ><span class="devsite-nav-text" tooltip>Run Windows Server failover clustering</span></a></li></ul></div></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Others</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Load testing</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/architecture/distributed-load-testing-using-gke" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /architecture/distributed-load-testing-using-gke" track-type="bookNav" track-name="click" track-metadata-eventdetail="/architecture/distributed-load-testing-using-gke" ><span class="devsite-nav-text" tooltip>Distributed load testing using Kubernetes</span></a></li><li class="devsite-nav-item"><a href="/community/tutorials/ssh-port-forwarding-set-up-load-testing-on-compute-engine" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /community/tutorials/ssh-port-forwarding-set-up-load-testing-on-compute-engine" track-type="bookNav" track-name="click" track-metadata-eventdetail="/community/tutorials/ssh-port-forwarding-set-up-load-testing-on-compute-engine" ><span class="devsite-nav-text" tooltip>SSH port forwarding and load testing</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Analytics</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/architecture/monte-carlo-methods-with-hadoop-spark" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /architecture/monte-carlo-methods-with-hadoop-spark" track-type="bookNav" track-name="click" track-metadata-eventdetail="/architecture/monte-carlo-methods-with-hadoop-spark" ><span class="devsite-nav-text" tooltip>Monte Carlo methods using Apache Spark</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Machine learning</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/tutorials/ml-inference-t4" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/tutorials/ml-inference-t4" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/tutorials/ml-inference-t4" ><span class="devsite-nav-text" tooltip>Run TensorFlow inference workloads with TensorRT5 and NVIDIA T4 GPU</span></a></li></ul></div></li></ul></div></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Monitor</span> </div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Monitor logs</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/logging/audit-logging" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/logging/audit-logging" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/logging/audit-logging" ><span class="devsite-nav-text" tooltip>View audit logs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/logging/usage-export" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/logging/usage-export" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/logging/usage-export" ><span class="devsite-nav-text" tooltip>View usage reports</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/viewing-compute-operations" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/viewing-compute-operations" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/viewing-compute-operations" ><span class="devsite-nav-text" tooltip>View Compute Engine operations</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/logging/migrating-from-activity-logs-to-audit-logs" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/logging/migrating-from-activity-logs-to-audit-logs" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/logging/migrating-from-activity-logs-to-audit-logs" ><span class="devsite-nav-text" tooltip>Migrate from activity logs to audit logs</span></a></li><li class="devsite-nav-item devsite-nav-deprecated"><a href="/compute/docs/logging/activity-logs" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/logging/activity-logs" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/logging/activity-logs" ><span class="devsite-nav-text" tooltip>View activity logs</span><span class="devsite-nav-icon material-icons" data-icon="deprecated" data-title="Deprecated" aria-hidden="true"></span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Monitor resources</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/nodes/determining-server-usage" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/nodes/determining-server-usage" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/nodes/determining-server-usage" ><span class="devsite-nav-text" tooltip>Monitor VM and sole-tenant node usage</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/observe-monitor-vms" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/observe-monitor-vms" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/observe-monitor-vms" ><span class="devsite-nav-text" tooltip>Observe and monitor VMs</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Monitor GPU performance</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/gpus/monitor-gpus" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/gpus/monitor-gpus" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/gpus/monitor-gpus" ><span class="devsite-nav-text" tooltip>Monitor GPU performance on Linux VMs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/gpus/monitor-gpus-windows" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/gpus/monitor-gpus-windows" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/gpus/monitor-gpus-windows" ><span class="devsite-nav-text" tooltip>Monitor GPU performance on Windows VMs</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Monitor disks</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/disks/monitor-regional-persistent-disk-replica-state" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/monitor-regional-persistent-disk-replica-state" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/monitor-regional-persistent-disk-replica-state" ><span class="devsite-nav-text" tooltip>Monitor the replica states of regional persistent disk volumes</span></a></li></ul></div></li><li class="devsite-nav-item"><a href="/compute/docs/instances/reservations-monitor" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/reservations-monitor" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/reservations-monitor" ><span class="devsite-nav-text" tooltip>Monitor reservations</span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/compute/docs/labeling-resources" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/labeling-resources" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/labeling-resources" ><span class="devsite-nav-text" tooltip>Organize resources using labels</span></a></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Scale</span> </div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Autoscale groups of VMs</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/autoscaler" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/autoscaler" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/autoscaler" ><span class="devsite-nav-text" tooltip>About autoscaling groups of VMs</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Create and manage autoscalers</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/autoscaler/scaling-cpu" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/autoscaler/scaling-cpu" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/autoscaler/scaling-cpu" ><span class="devsite-nav-text" tooltip>Scale based on CPU utilization</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/autoscaler/predictive-autoscaling" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/autoscaler/predictive-autoscaling" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/autoscaler/predictive-autoscaling" ><span class="devsite-nav-text" tooltip>Scale based on predictions</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/autoscaler/scaling-load-balancing" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/autoscaler/scaling-load-balancing" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/autoscaler/scaling-load-balancing" ><span class="devsite-nav-text" tooltip>Scale based on load balancing serving capacity</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/autoscaler/scaling-cloud-monitoring-metrics" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/autoscaler/scaling-cloud-monitoring-metrics" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/autoscaler/scaling-cloud-monitoring-metrics" ><span class="devsite-nav-text" tooltip>Scale based on Monitoring metrics</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/autoscaler/scaling-schedules" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/autoscaler/scaling-schedules" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/autoscaler/scaling-schedules" ><span class="devsite-nav-text" tooltip>Scale based on schedules</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/autoscaler/multiple-signals" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/autoscaler/multiple-signals" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/autoscaler/multiple-signals" ><span class="devsite-nav-text" tooltip>Use an autoscaling policy with multiple signals</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/autoscaler/managing-autoscalers" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/autoscaler/managing-autoscalers" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/autoscaler/managing-autoscalers" ><span class="devsite-nav-text" tooltip>Manage autoscalers</span></a></li></ul></div></li><li class="devsite-nav-item"><a href="/compute/docs/autoscaler/understanding-autoscaler-decisions" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/autoscaler/understanding-autoscaler-decisions" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/autoscaler/understanding-autoscaler-decisions" ><span class="devsite-nav-text" tooltip>Understand autoscaler decisions</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/autoscaler/viewing-autoscaler-logs" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/autoscaler/viewing-autoscaler-logs" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/autoscaler/viewing-autoscaler-logs" ><span class="devsite-nav-text" tooltip>View autoscaler logs</span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/compute/docs/nodes/autoscaling-node-groups" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/nodes/autoscaling-node-groups" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/nodes/autoscaling-node-groups" ><span class="devsite-nav-text" tooltip>Autoscale node groups</span></a></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Reserve VM capacity</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/reservations-overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/reservations-overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/reservations-overview" ><span class="devsite-nav-text" tooltip>About reservations</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Reservations on demand</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/reservations-single-project" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/reservations-single-project" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/reservations-single-project" ><span class="devsite-nav-text" tooltip>Create a reservation for a single project</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/reservations-shared" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/reservations-shared" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/reservations-shared" ><span class="devsite-nav-text" tooltip>Create a shared reservation</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/reservations-with-commitments" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/reservations-with-commitments" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/reservations-with-commitments" ><span class="devsite-nav-text" tooltip>Combine reservations with committed use discounts</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/reservations-view" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/reservations-view" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/reservations-view" ><span class="devsite-nav-text" tooltip>View your reservations</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/reservations-consume" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/reservations-consume" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/reservations-consume" ><span class="devsite-nav-text" tooltip>Consume reservations</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/reservations-modify" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/reservations-modify" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/reservations-modify" ><span class="devsite-nav-text" tooltip>Modify reservations</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/reservations-delete" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/reservations-delete" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/reservations-delete" ><span class="devsite-nav-text" tooltip>Delete reservations</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable devsite-nav-preview"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Future reservations</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/future-reservations-overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/future-reservations-overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/future-reservations-overview" ><span class="devsite-nav-text" tooltip>About future reservations requests</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/create-single-project-future-reservations" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/create-single-project-future-reservations" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/create-single-project-future-reservations" ><span class="devsite-nav-text" tooltip>Create single-project future reservation requests</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/create-shared-future-reservations" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/create-shared-future-reservations" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/create-shared-future-reservations" ><span class="devsite-nav-text" tooltip>Create shared future reservation requests</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/modify-future-reservations" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/modify-future-reservations" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/modify-future-reservations" ><span class="devsite-nav-text" tooltip>Modify future reservation requests</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/delete-future-reservations" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/delete-future-reservations" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/delete-future-reservations" ><span class="devsite-nav-text" tooltip>Cancel or delete future reservation requests</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/view-future-reservations" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/view-future-reservations" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/view-future-reservations" ><span class="devsite-nav-text" tooltip>View future reservation requests</span></a></li></ul></div></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Load balancing</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/load-balancing-and-autoscaling" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/load-balancing-and-autoscaling" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/load-balancing-and-autoscaling" ><span class="devsite-nav-text" tooltip>About load balancing and scaling</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/adding-an-instance-group-to-a-load-balancer" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/adding-an-instance-group-to-a-load-balancer" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/adding-an-instance-group-to-a-load-balancer" ><span class="devsite-nav-text" tooltip>Add an instance group to a load balancer</span></a></li><li class="devsite-nav-item"><a href="/load-balancing/docs/https/setting-up-https" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /load-balancing/docs/https/setting-up-https" track-type="bookNav" track-name="click" track-metadata-eventdetail="/load-balancing/docs/https/setting-up-https" ><span class="devsite-nav-text" tooltip>Request routing to a multi-region external HTTPS load balancer</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/tutorials/http-load-balancing-iis" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/tutorials/http-load-balancing-iis" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/tutorials/http-load-balancing-iis" ><span class="devsite-nav-text" tooltip>Cross-region load balancing for Microsoft IIS backends</span></a></li><li class="devsite-nav-item"><a href="/load-balancing/docs/internal/setting-up-internal" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /load-balancing/docs/internal/setting-up-internal" track-type="bookNav" track-name="click" track-metadata-eventdetail="/load-balancing/docs/internal/setting-up-internal" ><span class="devsite-nav-text" tooltip>Set up Internal TCP/UDP Load Balancing</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Build reliable and scalable applications</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/tutorials/high-availability-autohealing" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/tutorials/high-availability-autohealing" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/tutorials/high-availability-autohealing" ><span class="devsite-nav-text" tooltip>Use autohealing for highly available applications</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/tutorials/high-availability-load-balancing" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/tutorials/high-availability-load-balancing" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/tutorials/high-availability-load-balancing" ><span class="devsite-nav-text" tooltip>Use load balancing for highly available applications</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/tutorials/high-scalability-autoscaling" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/tutorials/high-scalability-autoscaling" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/tutorials/high-scalability-autoscaling" ><span class="devsite-nav-text" tooltip>Use autoscaling for highly scalable applications</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/tutorials/globally-autoscaling-a-web-service-on-compute-engine" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/tutorials/globally-autoscaling-a-web-service-on-compute-engine" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/tutorials/globally-autoscaling-a-web-service-on-compute-engine" ><span class="devsite-nav-text" tooltip>Globally autoscale a web service on Compute Engine</span></a></li><li class="devsite-nav-item"><a href="/architecture/scalable-and-resilient-apps" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /architecture/scalable-and-resilient-apps" track-type="bookNav" track-name="click" track-metadata-eventdetail="/architecture/scalable-and-resilient-apps" ><span class="devsite-nav-text" tooltip>Patterns for scalable and resilient applications</span></a></li><li class="devsite-nav-item"><a href="/architecture/patterns-for-floating-ip-addresses-in-compute-engine" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /architecture/patterns-for-floating-ip-addresses-in-compute-engine" track-type="bookNav" track-name="click" track-metadata-eventdetail="/architecture/patterns-for-floating-ip-addresses-in-compute-engine" ><span class="devsite-nav-text" tooltip>Patterns for using floating IP addresses on Compute Engine</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Optimize</span> </div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Resource utilization</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Use recommendations to manage resources</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/apply-machine-type-recommendations-for-instances" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/apply-machine-type-recommendations-for-instances" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/apply-machine-type-recommendations-for-instances" ><span class="devsite-nav-text" tooltip>Apply machine type recommendations to VMs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/apply-machine-type-recommendations-managed-instance-groups" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/apply-machine-type-recommendations-managed-instance-groups" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/apply-machine-type-recommendations-managed-instance-groups" ><span class="devsite-nav-text" tooltip>Apply machine type recommendations to MIGs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/viewing-and-applying-idle-resources-recommendations" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/viewing-and-applying-idle-resources-recommendations" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/viewing-and-applying-idle-resources-recommendations" ><span class="devsite-nav-text" tooltip>View and apply idle resources recommendations</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/view-and-understand-vm-insights" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/view-and-understand-vm-insights" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/view-and-understand-vm-insights" ><span class="devsite-nav-text" tooltip>View and understand VM insights</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instance-groups/view-and-understand-mig-insights" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instance-groups/view-and-understand-mig-insights" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instance-groups/view-and-understand-mig-insights" ><span class="devsite-nav-text" tooltip>View and understand MIG insights</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Manage idle VM recommendations</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/idle-vm-recommendations-overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/idle-vm-recommendations-overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/idle-vm-recommendations-overview" ><span class="devsite-nav-text" tooltip>Idle VM recommendations overview</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/viewing-and-applying-idle-vm-recommendations" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/viewing-and-applying-idle-vm-recommendations" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/viewing-and-applying-idle-vm-recommendations" ><span class="devsite-nav-text" tooltip>View and apply idle VM recommendations</span></a></li><li class="devsite-nav-item devsite-nav-preview"><a href="/compute/docs/instances/configuring-idle-vm-recommendations" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/configuring-idle-vm-recommendations" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/configuring-idle-vm-recommendations" ><span class="devsite-nav-text" tooltip>Configure idle VM recommendations</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable devsite-nav-preview"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Manage reservation recommendations</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/reservation-recommendations-overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/reservation-recommendations-overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/reservation-recommendations-overview" ><span class="devsite-nav-text" tooltip>Reservation recommendations overview</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/view-and-apply-idle-reservation-recommendations" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/view-and-apply-idle-reservation-recommendations" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/view-and-apply-idle-reservation-recommendations" ><span class="devsite-nav-text" tooltip>View and apply idle reservation recommendations</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/view-and-apply-underutilized-reservation-recommendations" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/view-and-apply-underutilized-reservation-recommendations" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/view-and-apply-underutilized-reservation-recommendations" ><span class="devsite-nav-text" tooltip>View and apply underutilized reservation recommendations</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/configure-idle-reservation-recommendations" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/configure-idle-reservation-recommendations" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/configure-idle-reservation-recommendations" ><span class="devsite-nav-text" tooltip>Configure idle reservation recommendations</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/configure-underutilized-reservation-recommendations" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/configure-underutilized-reservation-recommendations" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/configure-underutilized-reservation-recommendations" ><span class="devsite-nav-text" tooltip>Configure underutilized reservation recommendations</span></a></li></ul></div></li></ul></div></li><li class="devsite-nav-item"><a href="/compute/docs/nodes/overcommitting-cpus-sole-tenant-vms" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/nodes/overcommitting-cpus-sole-tenant-vms" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/nodes/overcommitting-cpus-sole-tenant-vms" ><span class="devsite-nav-text" tooltip>Overcommit CPUs on sole-tenant VMs</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Manual live migration</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/nodes/about-manual-live-migration" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/nodes/about-manual-live-migration" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/nodes/about-manual-live-migration" ><span class="devsite-nav-text" tooltip>About manual live migration</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/nodes/manually-live-migrate" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/nodes/manually-live-migrate" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/nodes/manually-live-migrate" ><span class="devsite-nav-text" tooltip>Manually live migrate VMs</span></a></li></ul></div></li><li class="devsite-nav-item"><a href="/compute/docs/nodes/share-node-groups" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/nodes/share-node-groups" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/nodes/share-node-groups" ><span class="devsite-nav-text" tooltip>Share sole-tenant node groups</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/dynamic-resource-management" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/dynamic-resource-management" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/dynamic-resource-management" ><span class="devsite-nav-text" tooltip>Next generation dynamic resource management</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Cost savings</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Get discounts for committed usage</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/committed-use-discounts-overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/committed-use-discounts-overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/committed-use-discounts-overview" ><span class="devsite-nav-text" tooltip>About commitments and committed use discounts (CUDs)</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/signing-up-committed-use-discounts" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/signing-up-committed-use-discounts" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/signing-up-committed-use-discounts" ><span class="devsite-nav-text" tooltip>Resource-based CUDs</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Manage resource-based commitments</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/renew-commitments-automatically" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/renew-commitments-automatically" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/renew-commitments-automatically" ><span class="devsite-nav-text" tooltip>Renew commitments automatically</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/committed-use-discounts/extend-commitment-term" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/committed-use-discounts/extend-commitment-term" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/committed-use-discounts/extend-commitment-term" ><span class="devsite-nav-text" tooltip>Extend the term length of commitments</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/merge-and-split-commitments" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/merge-and-split-commitments" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/merge-and-split-commitments" ><span class="devsite-nav-text" tooltip>Merge and split commitments</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/upgrade-commitment-term" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/upgrade-commitment-term" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/upgrade-commitment-term" ><span class="devsite-nav-text" tooltip>Upgrade the term of commitments</span></a></li></ul></div></li></ul></div></li><li class="devsite-nav-item"><a href="/compute/docs/sustained-use-discounts" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/sustained-use-discounts" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/sustained-use-discounts" ><span class="devsite-nav-text" tooltip>Get discounts for sustained usage</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Disk performance</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/disks/optimize-hyperdisk" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/optimize-hyperdisk" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/optimize-hyperdisk" ><span class="devsite-nav-text" tooltip>Optimize Hyperdisk performance</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/optimizing-pd-performance" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/optimizing-pd-performance" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/optimizing-pd-performance" ><span class="devsite-nav-text" tooltip>Optimize Persistent Disk performance</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/disks/optimizing-local-ssd-performance" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/disks/optimizing-local-ssd-performance" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/disks/optimizing-local-ssd-performance" ><span class="devsite-nav-text" tooltip>Optimize Local SSD performance</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Workload performance</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/instances/set-threads-per-core" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/set-threads-per-core" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/set-threads-per-core" ><span class="devsite-nav-text" tooltip>Set the number of threads per core</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/customize-visible-cores" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/customize-visible-cores" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/customize-visible-cores" ><span class="devsite-nav-text" tooltip>Customize the number of visible CPU cores</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Analyze the CPU performance using the PMU</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/pmu-overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/pmu-overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/pmu-overview" ><span class="devsite-nav-text" tooltip>PMU overview</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/enable-pmu-in-vms" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/enable-pmu-in-vms" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/enable-pmu-in-vms" ><span class="devsite-nav-text" tooltip>Enable the PMU in VMs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/manage-pmu-in-vms" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/manage-pmu-in-vms" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/manage-pmu-in-vms" ><span class="devsite-nav-text" tooltip>Manage the PMU in VMs</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Accelerated workloads with GPUs</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>GPUs on Compute Engine</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/gpus/about-gpus" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/gpus/about-gpus" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/gpus/about-gpus" ><span class="devsite-nav-text" tooltip>About GPUs</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Install drivers</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/gpus/install-drivers-gpu" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/gpus/install-drivers-gpu" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/gpus/install-drivers-gpu" ><span class="devsite-nav-text" tooltip>Install GPU drivers</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/gpus/install-grid-drivers" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/gpus/install-grid-drivers" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/gpus/install-grid-drivers" ><span class="devsite-nav-text" tooltip>Install drivers for NVIDIA RTX Virtual Workstations (vWS)</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/gpus/grid-drivers-table" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/gpus/grid-drivers-table" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/gpus/grid-drivers-table" ><span class="devsite-nav-text" tooltip>Drivers for NVIDIA RTX Virtual Workstations (vWS)</span></a></li></ul></div></li></ul></div></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Network performance</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/network-bandwidth" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/network-bandwidth" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/network-bandwidth" ><span class="devsite-nav-text" tooltip>Network bandwidth</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/networking/using-gvnic" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/networking/using-gvnic" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/networking/using-gvnic" ><span class="devsite-nav-text" tooltip>Use Google Virtual NIC</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/networking/using-idpf" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/networking/using-idpf" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/networking/using-idpf" ><span class="devsite-nav-text" tooltip>Use IDPF network interface</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/networking/configure-vm-with-high-bandwidth-configuration" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/networking/configure-vm-with-high-bandwidth-configuration" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/networking/configure-vm-with-high-bandwidth-configuration" ><span class="devsite-nav-text" tooltip>Configure a VM with higher bandwidth</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/instances/use-compact-placement-policies" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/instances/use-compact-placement-policies" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/instances/use-compact-placement-policies" ><span class="devsite-nav-text" tooltip>Reduce latency by using compact placement policies</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/networking/tcp-optimization-for-network-performance-in-gcp-and-hybrid" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/networking/tcp-optimization-for-network-performance-in-gcp-and-hybrid" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/networking/tcp-optimization-for-network-performance-in-gcp-and-hybrid" ><span class="devsite-nav-text" tooltip>Optimize TCP network performance</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/networking/benchmarking-higher-bandwidth-vms" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/networking/benchmarking-higher-bandwidth-vms" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/networking/benchmarking-higher-bandwidth-vms" ><span class="devsite-nav-text" tooltip>Benchmark higher bandwidth VMs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/load-balancing/optimize-app-latency" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/load-balancing/optimize-app-latency" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/load-balancing/optimize-app-latency" ><span class="devsite-nav-text" tooltip>Optimize app latency with load balancing</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/networking/use-dpdk" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/networking/use-dpdk" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/networking/use-dpdk" ><span class="devsite-nav-text" tooltip>Use DPDK to improve network performance</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Network performance and GPU VMs</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/gpus/gpu-network-bandwidth" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/gpus/gpu-network-bandwidth" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/gpus/gpu-network-bandwidth" ><span class="devsite-nav-text" tooltip>Network bandwidths and GPUs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/gpus/optimize-gpus" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/gpus/optimize-gpus" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/gpus/optimize-gpus" ><span class="devsite-nav-text" tooltip>Use higher network bandwidth</span></a></li></ul></div></li></ul></div></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Troubleshoot</span> </div></li> <li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/general-tips" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/general-tips" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/general-tips" ><span class="devsite-nav-text" tooltip>General tips</span></a></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Troubleshoot connectivity</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-rdp" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-rdp" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-rdp" ><span class="devsite-nav-text" tooltip>Troubleshoot RDP</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-ssh-errors" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-ssh-errors" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-ssh-errors" ><span class="devsite-nav-text" tooltip>Troubleshoot SSH</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshoot-os-login" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshoot-os-login" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshoot-os-login" ><span class="devsite-nav-text" tooltip>Troubleshoot OS Login</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Troubleshoot VMs</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Troubleshoot VM operations</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-vm-creation" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-vm-creation" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-vm-creation" ><span class="devsite-nav-text" tooltip>Troubleshoot VM creation</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-resource-availability" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-resource-availability" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-resource-availability" ><span class="devsite-nav-text" tooltip>Troubleshoot resource availability errors</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-bulk-vm-creation" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-bulk-vm-creation" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-bulk-vm-creation" ><span class="devsite-nav-text" tooltip>Troubleshoot bulk API VM creation</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-reboots" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-reboots" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-reboots" ><span class="devsite-nav-text" tooltip>Troubleshoot VM reboots and shutdowns</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-suspend-resume" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-suspend-resume" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-suspend-resume" ><span class="devsite-nav-text" tooltip>Troubleshoot VM suspension</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Troubleshoot unresponsive VMs</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/vm-startup" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/vm-startup" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/vm-startup" ><span class="devsite-nav-text" tooltip>Troubleshoot VM startup</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/fstab-errors" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/fstab-errors" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/fstab-errors" ><span class="devsite-nav-text" tooltip>Troubleshoot fstab errors</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/kernel-panic" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/kernel-panic" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/kernel-panic" ><span class="devsite-nav-text" tooltip>Troubleshoot kernel panic</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/collecting-diagnostic-information" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/collecting-diagnostic-information" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/collecting-diagnostic-information" ><span class="devsite-nav-text" tooltip>Collecting diagnostic information</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/collecting-core-dumps" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/collecting-core-dumps" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/collecting-core-dumps" ><span class="devsite-nav-text" tooltip>Collecting core dumps</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/rescue-vm" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/rescue-vm" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/rescue-vm" ><span class="devsite-nav-text" tooltip>Rescue an inaccessible VM</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-cpu-soft-lockup" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-cpu-soft-lockup" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-cpu-soft-lockup" ><span class="devsite-nav-text" tooltip>Troubleshoot CPU soft lockups</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Troubleshoot VM configurations</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-arm-vms" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-arm-vms" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-arm-vms" ><span class="devsite-nav-text" tooltip>Troubleshoot Arm VMs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-gpus" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-gpus" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-gpus" ><span class="devsite-nav-text" tooltip>Troubleshoot GPU VMs</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-nested-vms" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-nested-vms" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-nested-vms" ><span class="devsite-nav-text" tooltip>Troubleshoot nested virtualization</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/capturing-vm-screenshots" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/capturing-vm-screenshots" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/capturing-vm-screenshots" ><span class="devsite-nav-text" tooltip>Troubleshoot using VM screenshots</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-sole-tenancy" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-sole-tenancy" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-sole-tenancy" ><span class="devsite-nav-text" tooltip>Troubleshoot sole-tenant nodes</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-performance" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-performance" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-performance" ><span class="devsite-nav-text" tooltip>Troubleshoot VM performance issues</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-sudoers-file" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-sudoers-file" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-sudoers-file" ><span class="devsite-nav-text" tooltip>Troubleshoot sudoers files</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Troubleshoot Windows VMs</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-windows" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-windows" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-windows" ><span class="devsite-nav-text" tooltip>Troubleshoot Windows VMs</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Troubleshoot using the serial console</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-using-serial-console" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-using-serial-console" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-using-serial-console" ><span class="devsite-nav-text" tooltip>Troubleshoot using the serial console</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/viewing-serial-port-output" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/viewing-serial-port-output" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/viewing-serial-port-output" ><span class="devsite-nav-text" tooltip>Viewing serial port output</span></a></li></ul></div></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Troubleshoot instance groups</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-migs" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-migs" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-migs" ><span class="devsite-nav-text" tooltip>Troubleshoot managed instance groups (MIGs)</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Troubleshoot OS management</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/import-migrate" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/import-migrate" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/import-migrate" ><span class="devsite-nav-text" tooltip>Troubleshoot licenses</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-import-export-images" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-import-export-images" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-import-export-images" ><span class="devsite-nav-text" tooltip>Troubleshoot image import and export</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-suse-registration" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-suse-registration" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-suse-registration" ><span class="devsite-nav-text" tooltip>Troubleshooting SLES pay-as-you-go registration</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-ubuntu-pro-registration" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-ubuntu-pro-registration" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-ubuntu-pro-registration" ><span class="devsite-nav-text" tooltip>Troubleshooting Ubuntu Pro Registration</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Troubleshoot metadata server</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshoot-metadata-server" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshoot-metadata-server" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshoot-metadata-server" ><span class="devsite-nav-text" tooltip>Troubleshoot metadata server</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Troubleshoot networking issues</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-networking" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-networking" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-networking" ><span class="devsite-nav-text" tooltip>Troubleshoot common networking issues</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/gvnic" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/gvnic" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/gvnic" ><span class="devsite-nav-text" tooltip>Troubleshoot gVNIC</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-performance" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-performance" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-performance" ><span class="devsite-nav-text" tooltip>Troubleshoot VM performance issues</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Troubleshoot storage</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-disk-full-resize" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-disk-full-resize" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-disk-full-resize" ><span class="devsite-nav-text" tooltip>Troubleshoot full disks and disk resizing</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-disk-nvme" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-disk-nvme" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-disk-nvme" ><span class="devsite-nav-text" tooltip>Troubleshoot NVMe disks</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-instant-snapshots" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-instant-snapshots" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-instant-snapshots" ><span class="devsite-nav-text" tooltip>Troubleshoot instant snapshots</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-snapshots" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-snapshots" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-snapshots" ><span class="devsite-nav-text" tooltip>Troubleshoot standard snapshots</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Troubleshoot reservations and commitments</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-reservation-creation" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-reservation-creation" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-reservation-creation" ><span class="devsite-nav-text" tooltip>Troubleshoot reservation creation</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-reservation-consumption" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-reservation-consumption" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-reservation-consumption" ><span class="devsite-nav-text" tooltip>Troubleshoot reservation consumption</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-reservation-monitoring" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-reservation-monitoring" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-reservation-monitoring" ><span class="devsite-nav-text" tooltip>Troubleshooting reservation monitoring</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-reservation-updates" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-reservation-updates" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-reservation-updates" ><span class="devsite-nav-text" tooltip>Troubleshoot reservation updates</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshoot-future-reservations" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshoot-future-reservations" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshoot-future-reservations" ><span class="devsite-nav-text" tooltip>Troubleshoot future reservation creation and updates</span></a></li><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/automatic-commitment-renewal" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/automatic-commitment-renewal" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/automatic-commitment-renewal" ><span class="devsite-nav-text" tooltip>Troubleshoot automatic commitment renewal</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Troubleshoot workload authentication</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/compute/docs/troubleshooting/troubleshooting-default-service-accounts" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-default-service-accounts" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-default-service-accounts" ><span class="devsite-nav-text" tooltip>Troubleshoot default service accounts</span></a></li><li class="devsite-nav-item devsite-nav-preview"><a href="/compute/docs/troubleshooting/troubleshooting-workload-to-workload-auth" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /compute/docs/troubleshooting/troubleshooting-workload-to-workload-auth" track-type="bookNav" track-name="click" track-metadata-eventdetail="/compute/docs/troubleshooting/troubleshooting-workload-to-workload-auth" ><span class="devsite-nav-text" tooltip>Troubleshoot workload to workload authentication</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span></a></li></ul></div></li> </ul> <ul class="devsite-nav-list" menu="Technology areas" aria-label="Side menu" hidden> <li class="devsite-nav-item"> <a href="/docs/ai-ml" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: AI and ML" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > AI and ML </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/application-development" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Application development" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Application development </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/application-hosting" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Application hosting" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Application hosting </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/compute-area" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Compute" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Compute </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/data" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Data analytics and pipelines" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Data analytics and pipelines </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/databases" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Databases" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Databases </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/dhm-cloud" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Distributed, hybrid, and multicloud" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Distributed, hybrid, and multicloud </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/generative-ai" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Generative AI" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Generative AI </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/industry" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Industry solutions" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Industry solutions </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/networking" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Networking" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Networking </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/observability" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Observability and monitoring" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Observability and monitoring </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/security" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Security" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Security </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/storage" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Storage" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Storage </span> </a> </li> </ul> <ul class="devsite-nav-list" menu="Cross-product tools" aria-label="Side menu" hidden> <li class="devsite-nav-item"> <a href="/docs/access-resources" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Access and resources management" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Access and resources management </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/costs-usage" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Costs and usage management" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Costs and usage management </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/devtools" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Cloud SDK, languages, frameworks, and tools" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Cloud SDK, languages, frameworks, and tools </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/iac" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Infrastructure as code" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Infrastructure as code </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/migration" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Migration" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Migration </span> </a> </li> </ul> <ul class="devsite-nav-list" menu="Related sites" aria-label="Side menu" hidden> <li class="devsite-nav-item"> <a href="/" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Cloud Home" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Cloud Home </span> </a> </li> <li class="devsite-nav-item"> <a href="/free" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Free Trial and Free Tier" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Free Trial and Free Tier </span> </a> </li> <li class="devsite-nav-item"> <a href="/architecture" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Architecture Center" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Architecture Center </span> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/blog" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Blog" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Blog </span> </a> </li> <li class="devsite-nav-item"> <a href="/contact" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Contact Sales" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Contact Sales </span> </a> </li> <li class="devsite-nav-item"> <a href="/developers" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Cloud Developer Center" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Cloud Developer Center </span> </a> </li> <li class="devsite-nav-item"> <a href="https://developers.google.com/" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Developer Center" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Developer Center </span> </a> </li> <li class="devsite-nav-item"> <a href="https://console.cloud.google.com/marketplace" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Cloud Marketplace" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Cloud Marketplace </span> </a> </li> <li class="devsite-nav-item"> <a href="/marketplace/docs" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Cloud Marketplace Documentation" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Cloud Marketplace Documentation </span> </a> </li> <li class="devsite-nav-item"> <a href="https://www.cloudskillsboost.google/paths" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Cloud Skills Boost" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Cloud Skills Boost </span> </a> </li> <li class="devsite-nav-item"> <a href="/solutions" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Cloud Solution Center" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Cloud Solution Center </span> </a> </li> <li class="devsite-nav-item"> <a href="/support-hub" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Cloud Support" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Cloud Support </span> </a> </li> <li class="devsite-nav-item"> <a href="https://www.youtube.com/@googlecloudtech" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Cloud Tech Youtube Channel" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Cloud Tech Youtube Channel </span> </a> </li> </ul> </div> </div> </nav> </devsite-book-nav> <section id="gc-wrapper"> <main role="main" class="devsite-main-content" has-book-nav has-sidebar > <div class="devsite-sidebar"> <div class="devsite-sidebar-content"> <devsite-toc class="devsite-nav" role="navigation" aria-label="On this page" depth="2" scrollbars ></devsite-toc> <devsite-recommendations-sidebar class="nocontent devsite-nav"> </devsite-recommendations-sidebar> </div> </div> <devsite-content> <article class="devsite-article"> <div class="devsite-article-meta nocontent" role="navigation"> <ul class="devsite-breadcrumb-list" aria-label="Breadcrumb"> <li class="devsite-breadcrumb-item "> <a href="https://cloud.google.com/" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Breadcrumbs" data-value="1" track-type="globalNav" track-name="breadcrumb" track-metadata-position="1" track-metadata-eventdetail="Google Cloud" > Home </a> </li> <li class="devsite-breadcrumb-item "> <div class="devsite-breadcrumb-guillemet material-icons" aria-hidden="true"></div> <a href="https://cloud.google.com/compute" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Breadcrumbs" data-value="2" track-type="globalNav" track-name="breadcrumb" track-metadata-position="2" track-metadata-eventdetail="Compute Engine: Virtual Machines (VMs)" > Compute Engine </a> </li> <li class="devsite-breadcrumb-item "> <div class="devsite-breadcrumb-guillemet material-icons" aria-hidden="true"></div> <a href="https://cloud.google.com/compute/docs" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Breadcrumbs" data-value="3" track-type="globalNav" track-name="breadcrumb" track-metadata-position="3" track-metadata-eventdetail="Compute Engine Documentation" > Documentation </a> </li> <li class="devsite-breadcrumb-item "> <div class="devsite-breadcrumb-guillemet material-icons" aria-hidden="true"></div> <a href="https://cloud.google.com/compute/docs/overview" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Breadcrumbs" data-value="4" track-type="globalNav" track-name="breadcrumb" track-metadata-position="4" track-metadata-eventdetail="" > Guides </a> </li> </ul> <devsite-thumb-rating position="header"> </devsite-thumb-rating> </div> <devsite-feedback position="header" project-name="Compute Engine Documentation" product-id="81820" bucket="documentation" context="" version="t-devsite-webserver-20241114-r00-rc02.464922260396498922" data-label="Send Feedback Button" track-type="feedback" track-name="sendFeedbackLink" track-metadata-position="header" class="nocontent" project-feedback-url="https://issuetracker.google.com/issues/new?component=187134&amp;template=0" project-icon="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/images/favicons/onecloud/super_cloud.png" > <button> Send feedback </button> </devsite-feedback> <h1 class="devsite-page-title" tabindex="-1"> Create a VM with a custom machine type </h1> <devsite-feature-tooltip ack-key="AckCollectionsBookmarkTooltipDismiss" analytics-category="Site-Wide Custom Events" analytics-action-show="Callout Profile displayed" analytics-action-close="Callout Profile dismissed" analytics-label="Create Collection Callout" class="devsite-page-bookmark-tooltip nocontent" dismiss-button="true" id="devsite-collections-dropdown" dismiss-button-text="Dismiss" close-button-text="Got it"> <devsite-bookmark></devsite-bookmark> <span slot="popout-heading"> Stay organized with collections </span> <span slot="popout-contents"> Save and categorize content based on your preferences. </span> </devsite-feature-tooltip> <div class="devsite-page-title-meta"><devsite-view-release-notes></devsite-view-release-notes></div> <devsite-toc class="devsite-nav" depth="2" devsite-toc-embedded > </devsite-toc> <div class="devsite-article-body clearfix "> <hr class="cloud-divider"> <p>Compute Engine offers predefined machine types that you can use when you create a VM instance. A predefined machine type has a preset number of vCPUs and amount of memory, and is charged at a set price. If predefined VMs don&#39;t meet your needs, you can create a VM instance with custom virtualized hardware settings. Specifically, you can create a VM instance with a custom number of vCPUs and amount of memory, effectively using a custom machine type. Custom machine types are available in the <a href="/compute/docs/general-purpose-machines">general-purpose machine family</a> for the N and E machine series only. Custom machine types are not available for the C and Tau machine series. You can create a custom VM on the N4, N2, N2D, E2, or N1 machine types.</p> <p>Custom VMs are ideal in the following scenarios:</p> <ul> <li>Workloads that aren&#39;t a good fit for the predefined VM types.</li> <li>Workloads that require more processing power or more memory but don&#39;t need all upgrades that are provided by the next level machine type.</li> </ul> <h2 id="byb" data-text="Before you begin" tabindex="-1">Before you begin</h2> <ul> <li>Read the <a href="/compute/docs/machine-resource">machine families</a> documentation.</li> <li> If you haven't already, then set up authentication. <a href="/compute/docs/authentication">Authentication</a> is the process by which your identity is verified for access to Google Cloud services and APIs. To run code or samples from a local development environment, you can authenticate to Compute Engine by selecting one of the following options:<br/> <p>Select the tab for how you plan to use the samples on this page:</p> <div class="ds-selector-tabs" data-ds-scope="code-sample"> <section> <h3 id="console" data-text="Console" tabindex="-1">Console</h3> <p> When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication. </p> </section> <section> <h3 id="gcloud" data-text="gcloud" tabindex="-1">gcloud</h3> <ol><li> <p> <a href="/sdk/docs/install" track-type="commonIncludes" track-name="sdkLink" target="_blank">Install</a> the Google Cloud CLI, then <a href="/sdk/docs/initializing" track-type="commonIncludes" track-name="sdkLink" target="_blank">initialize</a> it by running the following command: </p> <pre class="prettyprint lang-sh" translate="no" dir="ltr">gcloud init</pre> <aside class="note"><strong>Note:</strong> If you installed the gcloud CLI previously, make sure you have the latest version by running <code translate="no" dir="ltr">gcloud components update</code>. </aside> </li><li><a href="/compute/docs/gcloud-compute#set_default_zone_and_region_in_your_local_client"> Set a default region and zone</a>.</li></ol> </section> <section> <h3 id="terraform" data-text="Terraform" tabindex="-1">Terraform</h3> <p> To use the Terraform samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials. </p> <ol> <li> <a href="/sdk/docs/install" track-type="commonIncludes" track-name="sdkLink" target="_blank">Install</a> the Google Cloud CLI. </li> <li> <p> To <a href="/sdk/docs/initializing" track-type="commonIncludes" track-name="sdkLink" target="_blank">initialize</a> the gcloud CLI, run the following command: </p> <pre class="prettyprint lang-sh" translate="no" dir="ltr">gcloud init</pre> </li> <li> <p> If you're using a local shell, then create local authentication credentials for your user account: </p> <pre class="prettyprint lang-sh" translate="no" dir="ltr">gcloud auth application-default login</pre> <p>You don't need to do this if you're using Cloud Shell.</p> </li> </ol> <p> For more information, see <a href="/compute/docs/authentication#local-development"> Set up authentication for a local development environment</a>. </p> </section> <section> <h3 id="go" data-text="Go" tabindex="-1">Go</h3> <p> To use the Go samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials. </p> <ol> <li> <a href="/sdk/docs/install" track-type="commonIncludes" track-name="sdkLink" target="_blank">Install</a> the Google Cloud CLI. </li> <li> <p> To <a href="/sdk/docs/initializing" track-type="commonIncludes" track-name="sdkLink" target="_blank">initialize</a> the gcloud CLI, run the following command: </p> <pre class="prettyprint lang-sh" translate="no" dir="ltr">gcloud init</pre> </li> <li> <p> If you're using a local shell, then create local authentication credentials for your user account: </p> <pre class="prettyprint lang-sh" translate="no" dir="ltr">gcloud auth application-default login</pre> <p>You don't need to do this if you're using Cloud Shell.</p> </li> </ol> <p> For more information, see <a href="/compute/docs/authentication#local-development"> Set up authentication for a local development environment</a>. </p> </section> <section> <h3 id="java" data-text="Java" tabindex="-1">Java</h3> <p> To use the Java samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials. </p> <ol> <li> <a href="/sdk/docs/install" track-type="commonIncludes" track-name="sdkLink" target="_blank">Install</a> the Google Cloud CLI. </li> <li> <p> To <a href="/sdk/docs/initializing" track-type="commonIncludes" track-name="sdkLink" target="_blank">initialize</a> the gcloud CLI, run the following command: </p> <pre class="prettyprint lang-sh" translate="no" dir="ltr">gcloud init</pre> </li> <li> <p> If you're using a local shell, then create local authentication credentials for your user account: </p> <pre class="prettyprint lang-sh" translate="no" dir="ltr">gcloud auth application-default login</pre> <p>You don't need to do this if you're using Cloud Shell.</p> </li> </ol> <p> For more information, see <a href="/compute/docs/authentication#local-development"> Set up authentication for a local development environment</a>. </p> </section> <section> <h3 id="node.js" data-text="Node.js" tabindex="-1">Node.js</h3> <p> To use the Node.js samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials. </p> <ol> <li> <a href="/sdk/docs/install" track-type="commonIncludes" track-name="sdkLink" target="_blank">Install</a> the Google Cloud CLI. </li> <li> <p> To <a href="/sdk/docs/initializing" track-type="commonIncludes" track-name="sdkLink" target="_blank">initialize</a> the gcloud CLI, run the following command: </p> <pre class="prettyprint lang-sh" translate="no" dir="ltr">gcloud init</pre> </li> <li> <p> If you're using a local shell, then create local authentication credentials for your user account: </p> <pre class="prettyprint lang-sh" translate="no" dir="ltr">gcloud auth application-default login</pre> <p>You don't need to do this if you're using Cloud Shell.</p> </li> </ol> <p> For more information, see <a href="/compute/docs/authentication#local-development"> Set up authentication for a local development environment</a>. </p> </section> <section> <h3 id="php" data-text="PHP" tabindex="-1">PHP</h3> <p> To use the PHP samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials. </p> <ol> <li> <a href="/sdk/docs/install" track-type="commonIncludes" track-name="sdkLink" target="_blank">Install</a> the Google Cloud CLI. </li> <li> <p> To <a href="/sdk/docs/initializing" track-type="commonIncludes" track-name="sdkLink" target="_blank">initialize</a> the gcloud CLI, run the following command: </p> <pre class="prettyprint lang-sh" translate="no" dir="ltr">gcloud init</pre> </li> <li> <p> If you're using a local shell, then create local authentication credentials for your user account: </p> <pre class="prettyprint lang-sh" translate="no" dir="ltr">gcloud auth application-default login</pre> <p>You don't need to do this if you're using Cloud Shell.</p> </li> </ol> <p> For more information, see <a href="/compute/docs/authentication#local-development"> Set up authentication for a local development environment</a>. </p> </section> <section> <h3 id="python" data-text="Python" tabindex="-1">Python</h3> <p> To use the Python samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials. </p> <ol> <li> <a href="/sdk/docs/install" track-type="commonIncludes" track-name="sdkLink" target="_blank">Install</a> the Google Cloud CLI. </li> <li> <p> To <a href="/sdk/docs/initializing" track-type="commonIncludes" track-name="sdkLink" target="_blank">initialize</a> the gcloud CLI, run the following command: </p> <pre class="prettyprint lang-sh" translate="no" dir="ltr">gcloud init</pre> </li> <li> <p> If you're using a local shell, then create local authentication credentials for your user account: </p> <pre class="prettyprint lang-sh" translate="no" dir="ltr">gcloud auth application-default login</pre> <p>You don't need to do this if you're using Cloud Shell.</p> </li> </ol> <p> For more information, see <a href="/compute/docs/authentication#local-development"> Set up authentication for a local development environment</a>. </p> </section> <section> <h3 id="rest" data-text="REST" tabindex="-1">REST</h3> <p> To use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI. </p> <ol> <p> <a href="/sdk/docs/install" track-type="commonIncludes" track-name="sdkLink" target="_blank">Install</a> the Google Cloud CLI, then <a href="/sdk/docs/initializing" track-type="commonIncludes" track-name="sdkLink" target="_blank">initialize</a> it by running the following command: </p> <pre class="prettyprint lang-sh" translate="no" dir="ltr">gcloud init</pre> </ol> <p> For more information, see <a href="/docs/authentication/rest">Authenticate for using REST</a> in the Google Cloud authentication documentation. </p> </section> </div> </li> </ul> <h3 id="required-roles" data-text="Required roles" tabindex="-1">Required roles</h3> <p> To get the permissions that you need to create a VM with a custom machine type, ask your administrator to grant you the <a href="https://cloud.google.com/iam/docs/understanding-roles#compute.instanceAdmin.v1">Compute Instance Admin (v1) </a> (<code translate="no" dir="ltr">roles/compute.instanceAdmin.v1</code>) IAM role on the project. For more information about granting roles, see <a href="/iam/docs/granting-changing-revoking-access">Manage access to projects, folders, and organizations</a>. </p> <p> This predefined role contains the permissions required to create a VM with a custom machine type. To see the exact permissions that are required, expand the <strong>Required permissions</strong> section: </p> <devsite-expandable> <h4 class="showalways" id="required-permissions" data-text="Required permissions" tabindex="-1">Required permissions</h4> <p>The following permissions are required to create a VM with a custom machine type:</p> <ul> <li> To add extended memory to an existing VM: <code translate="no" dir="ltr">compute.instances.setMachineType</code> on the VM </li> <li> To create a VM with a custom machine type: <ul> <li><code translate="no" dir="ltr">compute.instances.create</code> on the project</li> <li>To use a custom image to create the VM&colon; <code translate="no" dir="ltr">compute.images.useReadOnly</code> on the image</li> <li>To use a snapshot to create the VM&colon; <code translate="no" dir="ltr">compute.snapshots.useReadOnly</code> on the snapshot</li> <li>To use an instance template to create the VM&colon; <code translate="no" dir="ltr">compute.instanceTemplates.useReadOnly</code> on the instance template</li> <li>To assign a <a href="/vpc/docs/legacy">legacy network</a> to the VM&colon; <code translate="no" dir="ltr">compute.networks.use</code> on the project</li> <li>To specify a static IP address for the VM&colon; <code translate="no" dir="ltr">compute.addresses.use</code> on the project</li> <li>To assign an external IP address to the VM when using a legacy network&colon; <code translate="no" dir="ltr">compute.networks.useExternalIp</code> on the project</li> <li>To specify a subnet for the VM&colon; <code translate="no" dir="ltr">compute.subnetworks.use</code> on the project or on the chosen subnet</li> <li>To assign an external IP address to the VM when using a VPC network&colon; <code translate="no" dir="ltr">compute.subnetworks.useExternalIp</code> on the project or on the chosen subnet</li> <li>To set VM instance metadata for the VM&colon; <code translate="no" dir="ltr">compute.instances.setMetadata</code> on the project</li> <li>To set tags for the VM&colon; <code translate="no" dir="ltr">compute.instances.setTags</code> on the VM</li> <li>To set labels for the VM&colon; <code translate="no" dir="ltr">compute.instances.setLabels</code> on the VM</li> <li>To set a service account for the VM to use&colon; <code translate="no" dir="ltr">compute.instances.setServiceAccount</code> on the VM</li> <li>To create a new disk for the VM&colon; <code translate="no" dir="ltr">compute.disks.create</code> on the project</li> <li>To attach an existing disk in read-only or read-write mode&colon; <code translate="no" dir="ltr">compute.disks.use</code> on the disk</li> <li>To attach an existing disk in read-only mode&colon; <code translate="no" dir="ltr">compute.disks.useReadOnly</code> on the disk</li> </ul> </li> </ul> </devsite-expandable> <p> You might also be able to get these permissions with <a href="/iam/docs/creating-custom-roles">custom roles</a> or other <a href="/iam/docs/understanding-roles">predefined roles</a>. </p> <h3 id="limitations" data-text="Limitations" tabindex="-1">Limitations</h3> <ul> <li>If your VM has Local SSD disks, you can&#39;t change the vCPU and memory configuration.</li> <li>Extended memory is only available on custom machine types. Predefined machine types are not supported.</li> <li>There is a maximum amount of memory you can add to each machine type.</li> <li>You must specify memory in 256 MB increments.</li> <li>Extended memory does not qualify for <a href="/compute/docs/instances/signing-up-committed-use-discounts">committed use discounts</a>.</li> <li>N4 and N2D machine types are available only in select <a href="/compute/docs/regions-zones#available">regions and zones</a>.</li> </ul> <h2 id="custom_machine_type_pricing" data-text="Custom machine type pricing" tabindex="-1">Custom machine type pricing</h2> <p>Google charges for custom VMs based on the number of vCPUs and memory hours that the VM uses. This is different from how predefined machine types are charged. The on-demand prices for custom machine types include a 5% premium over the on-demand prices for predefined machine types.</p> <ul> <li><p>When using a custom machine type, any memory up to and including the default amount per vCPU is charged at the machine family custom machine type pricing. E2 custom machine and E2 shared-core custom machine types share the same pricing scheme.</p></li> <li><p>If you use your <a href="/compute/docs/instances/signing-up-committed-use-discounts">commitments</a> to run custom machine types, then Compute Engine charges a 5% premium over the commitment prices. Compute Engine charges this premium for the portion and duration of your commitment that you run these custom machine type VMs.</p></li> </ul> <p>See <a href="/compute/vm-instance-pricing">VM instance pricing</a> for information by machine series.</p> <p>Custom VMs are subject to the same 1-minute minimum charge as any other instance, but sustained use discounts for custom machine types are calculated differently. For more information, see <a href="/compute/docs/sustained-use-discounts#sud_custom">sustained use discounts</a> for custom VMs.</p> <h3 id="pricingextendedmemory" data-text="Extended memory pricing" tabindex="-1">Extended memory pricing</h3> <p>For memory above the default, Compute Engine charges for extended memory based on the machine family extended custom memory pricing. The price for extended memory is different from the price for memory below the default threshold.</p> <p>Extended memory prices differ depending on the region. Instances running with extended memory are subject to the same 1-minute minimum charge as any other instance. Extended memory also qualifies for <a href="/compute/docs/sustained-use-discounts#sud_custom">sustained use discounts</a>.</p> <h2 id="extendedmemory" data-text="Add extended memory to a machine type" tabindex="-1">Add extended memory to a machine type</h2> <p>Depending on the machine series, each machine type has a specific amount of memory by default. For some workloads, this might not be enough memory. For an extra cost, you can get more memory per vCPU beyond the default limit. This is referred to as extended memory.</p> <p>With extended memory, you can specify an amount of memory for the custom machine type with no limitation per vCPU. Instead of using the default memory size based on the number of vCPUs specified, you can specify an amount of extended memory, up to the limit of the machine series.</p> <table> <thead> <tr> <th>Machine series</th> <th>vCPU limit</th> <th>Memory limit</th> </tr> </thead> <tbody> <tr> <td>N4</td> <td>80</td> <td>640 GB</td> </tr> <tr> <td>N2</td> <td>128</td> <td>640 GB</td> </tr> <tr> <td>N2D</td> <td>224</td> <td>768 GB</td> </tr> <tr> <td>E2</td> <td>32</td> <td>128 GB</td> </tr> <tr> <td>N1</td> <td>96</td> <td>624 GB</td> </tr> </tbody> </table> <p>If you require more memory, use one of the <a href="/compute/docs/memory-optimized-machines">memory-optimized machine</a> types, which lets you create VMs with a total memory of up to 12 TB per VM.</p> <h3 id="determine_if_you_need_extended_memory" data-text="Determine if you need extended memory" tabindex="-1">Determine if you need extended memory</h3> <p>Certain workloads need more than the default amount of memory per vCPU to deliver optimum results. Workloads that are based on in-memory high- performance analytics databases, including relational and NoSQL databases such as MS SQL Server, MongoDB, and MemcacheD/Redis, are in this category. The vCPU-based licensing of operating systems and software stacks also makes selecting an optimal VM memory configuration more challenging with predefined machine types. By using extended memory, you can add as much memory as your VMs need for the best price- performance ratio.</p> <h2 id="memory_units" data-text="Express memory in GB or MB" tabindex="-1">Express memory in GB or MB</h2> <p>For Google Cloud tools and documentation, machine type memory is calculated in gigabytes (GB), where 1 GB is 2<sup title="to the power of">30</sup> bytes. This unit of measurement is also known as a <a href="https://wikipedia.org/wiki/Gibibyte" track-name="externalLink">gibibyte (GiB)</a> . When converting memory from GB to MB, 1 GB = 1024 MB.</p> <p>In the API, you must always provide memory in megabytes. If you use the Google Cloud CLI, you can provide the total memory for a VM in gigabytes or megabytes. However, the gcloud CLI expects the memory value to be an integer, so you cannot provide a float value. For example, to express 5.75 GB, convert 5.75 GB into MB instead. In this case, 5.75 GB is 5888 MB.</p> <h2 id="create" data-text="Create a VM with a custom machine type" tabindex="-1">Create a VM with a custom machine type</h2> Before you create a custom VM instance, make sure you read the <a href="/compute/docs/general-purpose-machines#custom_machine_types">custom specifications</a> for creating this machine type.</p> <div class="ds-selector-tabs" data-ds-scope="code-sample"> <section><h3 id="console" data-text=" Console " tabindex="-1"> Console </h3><ol> <li><p>In the Google Cloud console, go to the <strong>Create an instance</strong> page.</p> <p><a href="https://console.cloud.google.com/compute/instancesAdd" target="console" track-type="tasks" track-name="consoleLink" track-metadata-position="body" track-metadata-end-goal="createInstanceCustomMachineType" class="button button-primary">Go to Create an instance</a> </p></li> <li><p>Select the <strong>Region</strong> and <strong>Zone</strong> where you want to host the VM.</p></li> <li><p>In the <strong>Machine configuration</strong> section, select <strong>General-purpose</strong>.</p> <ol> <li>In the <strong>Series</strong> list, select a machine series to create a custom machine; N4, N2, N2D, E2, and N1 offer custom machine types.</li> <li>In the <strong>Machine type</strong> section, select <strong>Custom</strong>.</li> <li>To specify the number of vCPUs and the amount of memory for the VM instance, drag the sliders or enter the values in the text boxes. The console displays an estimated cost for the VM as you change the number of vCPUs and memory.</li> </ol></li> <li><p>Continue to create the VM.</p></li> </ol></section> <section><h3 id="gcloud" data-text="gcloud" tabindex="-1">gcloud</h3><p>Create a custom machine using the <a href="/sdk/gcloud/reference/compute/instances/create"><code translate="no" dir="ltr">gcloud compute instances create</code></a> command with the <code translate="no" dir="ltr">--machine-type</code> option.</p> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded><code translate="no" dir="ltr"> gcloud compute instances create <var translate="no">INSTANCE_NAME</var> \ --machine-type=<var translate="no">MACHINE_TYPE</var>-<var translate="no">NUMBER_OF_VCPUS</var>-<var translate="no">AMOUNT_OF_MEMORY_MB</var> </code></pre></devsite-code> <p>Replace the following:</p> <ul> <li><var translate="no">INSTANCE_NAME</var>: instance name</li> <li><var translate="no">MACHINE_TYPE</var>: machine type, like N2</li> <li><var translate="no">NUMBER_OF_VCPUS</var>: number of vCPUs</li> <li><var translate="no">AMOUNT_OF_MEMORY_MB</var>: amount of memory in MB or GB</li> </ul> <p>Here&#39;s an example using an N2 machine type with 48 vCPUs and 310 GB of memory in zone <code translate="no" dir="ltr">us-central1-a</code>:</p> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded><code translate="no" dir="ltr"> gcloud compute instances create example-instance \ --zone=us-central1-a --machine-type=n2-custom-48-317440 </code></pre></devsite-code> <p>Alternatively, you can specify a custom machine type by using the custom options: <code translate="no" dir="ltr">--custom-cpu</code>, <code translate="no" dir="ltr">--custom-memory</code>, <code translate="no" dir="ltr">--custom-vm-type</code>, and <code translate="no" dir="ltr">--custom-extensions</code>. To configure extended memory, which lets you specify a higher amount of memory than the maximum ratio of memory to vCPUs, increase the value of <code translate="no" dir="ltr">AMOUNT_OF_MEMORY_MB</code> and append <code translate="no" dir="ltr">-ext</code> to the machine type name.</p> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded><code translate="no" dir="ltr"> gcloud compute instances create <var translate="no">INSTANCE_NAME</var> \ --custom-cpu=<var translate="no">NUMBER_OF_VCPUS</var> \ --custom-memory=<var translate="no">NUMBER_OF_MB</var> \ --custom-vm-type=<var translate="no">MACHINE_TYPE</var> \ --custom-extension </code></pre></devsite-code> <p>Replace the following:</p> <ul> <li><var translate="no">INSTANCE_NAME</var>: name of instance</li> <li><var translate="no">NUMBER_OF_VCPUS</var>: number of vCPUs</li> <li><var translate="no">NUMBER_OF_MB</var>: amount of memory in MB or GB</li> <li><var translate="no">MACHINE_TYPE</var>: machine type, like N2</li> </ul> <p>The following example is an N2 custom machine type with 48 vCPUs and 310 GB of memory using the Google Cloud CLI options.</p> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded><code translate="no" dir="ltr"> gcloud compute instances create example-instance \ --custom-cpu=48 --custom-memory=317440 --custom-extension --custom-vm-type=n2 </code></pre></devsite-code> <p>When using the <code translate="no" dir="ltr">--custom-memory</code> option, specify the <strong>total amount</strong> of memory in GB or in MB. The property must be an integer, so if you want to specify increments of 0.25 GB for memory, convert that value to MB instead.</p> <p>For E2 shared-core custom machine types, use the same <a href="/sdk/gcloud/reference/compute/instances/create"><code translate="no" dir="ltr">gcloud compute instances create</code> command</a> and include the shared-core machine size: <code translate="no" dir="ltr">micro</code>, <code translate="no" dir="ltr">small</code>, or <code translate="no" dir="ltr">medium</code>. The vCPU and memory are limited.</p> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded><code translate="no" dir="ltr"> gcloud compute instances create <var translate="no">INSTANCE_NAME</var>\ --machine-type=<var translate="no">MACHINE_TYPE</var>-<var translate="no">AMOUNT_OF_MEMORY_MB</var> </code></pre></devsite-code> <p>Replace the following:</p> <ul> <li><var translate="no">INSTANCE_NAME</var>: name of instance</li> <li><var translate="no">MACHINE_TYPE</var>: E2 small</li> <li><var translate="no">AMOUNT_OF_MEMORY_MB</var>: amount of memory in MB or GB</li> </ul> <p>The following example is an E2 shared-core small custom machine type with 0.5 vCPU and 2.25 GB of memory.</p> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded><code translate="no" dir="ltr"> gcloud compute instances create example-instance \ --machine-type=e2-custom-small-2304 </code></pre></devsite-code></section> <section><h3 id="terraform" data-text=" Terraform " tabindex="-1"> Terraform </h3> To generate the Terraform code, you can use the <strong>Equivalent code</strong> component in the Google Cloud console. <ol> <li>In the Google Cloud console, go to the <strong>VM instances</strong> page. <p><a href="https://console.cloud.google.com/compute/instances" class="button button-primary" target="console" track-type="tasks" track-name="consoleLink" track-metadata-position="body" track-metadata-end-goal="connectToVm">Go to VM Instances</a></p></li> <li>Click <strong>Create instance</strong>.</li> <li>Specify the parameters you want.</li> <li>At the top or bottom of the page, click <strong>Equivalent code</strong>, and then click the <strong>Terraform</strong> tab to view the Terraform code.</li> </ol></section> <section><h3 id="go" data-text=" Go " tabindex="-1"> Go </h3> <section> <p> Before trying this sample, follow the <span class="notranslate">Go</span> setup instructions in the <a href="/compute/docs/api/using-libraries" track-type="clientLibrariesQuickstart" track-name="go" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/golang-samples/blob/HEAD/compute/instances/custom-machine-type/create_with_helper.go" track-metadata-position="compute_custom_machine_type_create_with_helper">Compute Engine quickstart using client libraries</a>. For more information, see the <a href="/go/docs/reference/cloud.google.com/go/compute/latest/apiv1" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="go" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/golang-samples/blob/HEAD/compute/instances/custom-machine-type/create_with_helper.go" track-metadata-region-tag="compute_custom_machine_type_create_with_helper">Compute Engine <span class="notranslate">Go</span> API reference documentation</a>. </p> <p> To authenticate to Compute Engine, set up Application Default Credentials. For more information, see <a href="/docs/authentication/provide-credentials-adc#local-dev">Set up authentication for a local development environment</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="GoogleCloudPlatform/golang-samples/compute/instances/custom-machine-type/create_with_helper.go/HEAD/compute_custom_machine_type_create_with_helper" data-code-snippet="true" data-github-includecode-link="https://github.com/GoogleCloudPlatform/golang-samples/blob/HEAD/compute/instances/custom-machine-type/create_with_helper.go" feedback-context="{&#34;language&#34;: &#34;go&#34;, &#34;region_tag&#34;: &#34;compute_custom_machine_type_create_with_helper&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/GoogleCloudPlatform/golang-samples/blob/HEAD/compute/instances/custom-machine-type/create_with_helper.go&#34;}" feedback-product="1634365" feedback-bucket="infraops" language="go" data-github-path="GoogleCloudPlatform/golang-samples/compute/instances/custom-machine-type/create_with_helper.go" data-git-revision="HEAD" data-region-tag="compute_custom_machine_type_create_with_helper" dir="ltr" is-upgraded syntax="Go"><code translate="no" dir="ltr"><span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"context"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"fmt"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"io"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">compute</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"cloud.google.com/go/compute/apiv1"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">computepb</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"cloud.google.com/go/compute/apiv1/computepb"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"google.golang.org/protobuf/proto"</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-kd">func</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">customMachineTypeURI</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">coreCount</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">memory</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">error</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">n1</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"custom"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">n2</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"n2-custom"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">n2d</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"n2d-custom"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">e2</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"e2-custom"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">e2Micro</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"e2-custom-micro"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">e2Small</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"e2-custom-small"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">e2Medium</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"e2-custom-medium"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">type</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">typeLimit</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">struct</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">allowedCores</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[]</span><span class="devsite-syntax-kt">int</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">minMemPerCore</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">maxMemPerCore</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">allowExtraMemory</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">bool</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">extraMemoryLimit</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">makeRange</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">func</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">start</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">end</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">step</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[]</span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">step</span><span class="devsite-syntax-w"> </span>&lt;<span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">||</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">end</span><span class="devsite-syntax-w"> &lt; </span><span class="devsite-syntax-nx">start</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[]</span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-p">{}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">s</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nb">make</span><span class="devsite-syntax-p">([]</span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">1</span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">end</span><span class="devsite-syntax-o">-</span><span class="devsite-syntax-nx">start</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-o">/</span><span class="devsite-syntax-nx">step</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">for</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">start</span><span class="devsite-syntax-w"> </span>&lt;<span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">end</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">s</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nb">append</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">s</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">start</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">start</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">step</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">s</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">containsString</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">func</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">s</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[]</span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">str</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">bool</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">for</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">_</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">v</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">range</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">s</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">v</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">==</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">str</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">true</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">false</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">containsInt</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">func</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">nums</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[]</span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">n</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">bool</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">for</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">_</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">v</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">range</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">nums</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">v</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">==</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">n</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">true</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">false</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">var</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeriesE2Limit</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">typeLimit</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">allowedCores</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">makeRange</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">2</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">33</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">2</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">minMemPerCore</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">512</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">maxMemPerCore</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">8192</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeriesE2MicroLimit</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">typeLimit</span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-nx">minMemPerCore</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">1024</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">maxMemPerCore</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">2048</span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeriesE2SmallLimit</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">typeLimit</span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-nx">minMemPerCore</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">2048</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">maxMemPerCore</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">4096</span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeriesE2MeidumLimit</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">typeLimit</span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-nx">minMemPerCore</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">4096</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">maxMemPerCore</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">8192</span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeriesN2Limit</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">typeLimit</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">allowedCores</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nb">append</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">makeRange</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">2</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">33</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">2</span><span class="devsite-syntax-p">),</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">makeRange</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">36</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">129</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">4</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-o">...</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">minMemPerCore</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">512</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">maxMemPerCore</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">8192</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">allowExtraMemory</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">true</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">extraMemoryLimit</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">624</span><span class="devsite-syntax-w"> &lt;&lt; </span><span class="devsite-syntax-mi">10</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeriesN2DLimit</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">typeLimit</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">allowedCores</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[]</span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-mi">2</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">4</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">8</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">16</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">32</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">48</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">64</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">80</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">96</span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">minMemPerCore</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">512</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">maxMemPerCore</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">8192</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">allowExtraMemory</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">true</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">extraMemoryLimit</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">768</span><span class="devsite-syntax-w"> &lt;&lt; </span><span class="devsite-syntax-mi">10</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeriesN1Limit</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">typeLimit</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">allowedCores</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nb">append</span><span class="devsite-syntax-p">([]</span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-mi">1</span><span class="devsite-syntax-p">},</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">makeRange</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">2</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">97</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">2</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-o">...</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">minMemPerCore</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">922</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">maxMemPerCore</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">6656</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">allowExtraMemory</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">true</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">extraMemoryLimit</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">624</span><span class="devsite-syntax-w"> &lt;&lt; </span><span class="devsite-syntax-mi">10</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">typeLimitsMap</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">map</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-nx">typeLimit</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">n1</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeriesN1Limit</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">n2</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeriesN2Limit</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">n2d</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeriesN2DLimit</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">e2</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeriesE2Limit</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">e2Micro</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeriesE2MicroLimit</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">e2Small</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeriesE2SmallLimit</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">e2Medium</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeriesE2MeidumLimit</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">!</span><span class="devsite-syntax-nx">containsString</span><span class="devsite-syntax-p">([]</span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-nx">e2</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">n1</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">n2</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">n2d</span><span class="devsite-syntax-p">},</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">""</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Errorf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"incorrect cpu type: %v"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">tl</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">typeLimitsMap</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-p">]</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Check whether the requested parameters are allowed.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Find more information about limitations of custom machine types at:</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// https://cloud.google.com/compute/docs/general-purpose-machines#custom_machine_types</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Check the number of cores</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nb">len</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">tl</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">allowedCores</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> &gt; </span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-w"> &amp;&amp; </span><span class="devsite-syntax-p">!</span><span class="devsite-syntax-nx">containsInt</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">tl</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">allowedCores</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">coreCount</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">""</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Errorf</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"invalid number of cores requested. Allowed number of cores for %v is: %v"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">tl</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">allowedCores</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Memory must be a multiple of 256 MB</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">memory</span><span class="devsite-syntax-o">%</span><span class="devsite-syntax-mi">256</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">""</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Errorf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"requested memory must be a multiple of 256 MB"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Check if the requested memory isn't too little</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">memory</span><span class="devsite-syntax-w"> &lt; </span><span class="devsite-syntax-nx">coreCount</span><span class="devsite-syntax-o">*</span><span class="devsite-syntax-nx">tl</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">minMemPerCore</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">""</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Errorf</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"requested memory is too low. Minimal memory for %v is %v MB per core"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">tl</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">minMemPerCore</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Check if the requested memory isn't too much</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">memory</span><span class="devsite-syntax-w"> &gt; </span><span class="devsite-syntax-nx">coreCount</span><span class="devsite-syntax-o">*</span><span class="devsite-syntax-nx">tl</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">maxMemPerCore</span><span class="devsite-syntax-w"> &amp;&amp; </span><span class="devsite-syntax-p">!</span><span class="devsite-syntax-nx">tl</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">allowExtraMemory</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">""</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Errorf</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"requested memory is too large.. Maximum memory allowed for %v is %v MB per core"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">tl</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">maxMemPerCore</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">memory</span><span class="devsite-syntax-w"> &gt; </span><span class="devsite-syntax-nx">tl</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">extraMemoryLimit</span><span class="devsite-syntax-w"> &amp;&amp; </span><span class="devsite-syntax-nx">tl</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">allowExtraMemory</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">""</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Errorf</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"requested memory is too large.. Maximum memory allowed for %v is %v MB"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">tl</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">extraMemoryLimit</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Return the custom machine type in form of a string acceptable by Compute Engine API.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">containsString</span><span class="devsite-syntax-p">([]</span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-nx">e2Small</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">e2Micro</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">e2Medium</span><span class="devsite-syntax-p">},</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Sprintf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"zones/%v/machineTypes/%v-%v"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">memory</span><span class="devsite-syntax-p">),</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">memory</span><span class="devsite-syntax-w"> &gt; </span><span class="devsite-syntax-nx">coreCount</span><span class="devsite-syntax-o">*</span><span class="devsite-syntax-nx">tl</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">maxMemPerCore</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Sprintf</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"zones/%v/machineTypes/%v-%v-%v-ext"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">coreCount</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">memory</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">),</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Sprintf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"zones/%v/machineTypes/%v-%v-%v"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">coreCount</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">memory</span><span class="devsite-syntax-p">),</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span> <span class="devsite-syntax-p">}</span> <span class="devsite-syntax-c1">// createInstanceWithCustomMachineTypeWithHelper creates a new VM instance with a custom machine type.</span> <span class="devsite-syntax-kd">func</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">createInstanceWithCustomMachineTypeWithHelper</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">w</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">io</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Writer</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">projectID</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instanceName</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">coreCount</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">memory</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">error</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// projectID := "your_project_id"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// zone := "europe-central2-b"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// instanceName := "your_instance_name"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// cpuSeries := "e2-custom-micro" // the type of CPU you want to use"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// coreCount := 2 // number of CPU cores you want to use.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// memory := 256 // the amount of memory for the VM instance, in megabytes.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">machineType</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">customMachineTypeURI</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">coreCount</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">memory</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Errorf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"unable to create custom machine type string: %w"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">ctx</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">context</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Background</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instancesClient</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">compute</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">NewInstancesRESTClient</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">ctx</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Errorf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"NewInstancesRESTClient: %w"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">defer</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instancesClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Close</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">req</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span>&amp;<span class="devsite-syntax-nx">computepb</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">InsertInstanceRequest</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Project</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">projectID</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Zone</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">InstanceResource</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span>&amp;<span class="devsite-syntax-nx">computepb</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Instance</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Name</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">proto</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">String</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">instanceName</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Disks</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[]</span><span class="devsite-syntax-o">*</span><span class="devsite-syntax-nx">computepb</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">AttachedDisk</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">InitializeParams</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span>&amp;<span class="devsite-syntax-nx">computepb</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">AttachedDiskInitializeParams</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">DiskSizeGb</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">proto</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Int64</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">10</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">SourceImage</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">proto</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">String</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"projects/debian-cloud/global/images/family/debian-12"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">AutoDelete</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">proto</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Bool</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-kc">true</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Boot</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">proto</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Bool</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-kc">true</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">MachineType</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">proto</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">String</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">machineType</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">NetworkInterfaces</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[]</span><span class="devsite-syntax-o">*</span><span class="devsite-syntax-nx">computepb</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">NetworkInterface</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Name</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">proto</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">String</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"global/networks/default"</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">op</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instancesClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Insert</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">ctx</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">req</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Errorf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"unable to create instance: %w"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">op</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Wait</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">ctx</span><span class="devsite-syntax-p">);</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Errorf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"unable to wait for the operation: %w"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Fprintf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">w</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"Instance created\n"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span> <span class="devsite-syntax-p">}</span> </code></pre></devsite-code> </div> </section> </section> <section><h3 id="java" data-text=" Java " tabindex="-1"> Java </h3> <section> <p> Before trying this sample, follow the <span class="notranslate">Java</span> setup instructions in the <a href="/compute/docs/api/using-libraries" track-type="clientLibrariesQuickstart" track-name="java" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/java-docs-samples/blob//compute/cloud-client/src/main/java/compute/custommachinetype/CreateWithHelper.java" track-metadata-position="compute_custom_machine_type_create_with_helper">Compute Engine quickstart using client libraries</a>. For more information, see the <a href="/java/docs/reference/google-cloud-compute/latest/overview" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="java" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/java-docs-samples/blob//compute/cloud-client/src/main/java/compute/custommachinetype/CreateWithHelper.java" track-metadata-region-tag="compute_custom_machine_type_create_with_helper">Compute Engine <span class="notranslate">Java</span> API reference documentation</a>. </p> <p> To authenticate to Compute Engine, set up Application Default Credentials. For more information, see <a href="/docs/authentication/provide-credentials-adc#local-dev">Set up authentication for a local development environment</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="GoogleCloudPlatform/java-docs-samples/compute/cloud-client/src/main/java/compute/custommachinetype/CreateWithHelper.java/HEAD/compute_custom_machine_type_create_with_helper" data-code-snippet="true" data-github-includecode-link="https://github.com/GoogleCloudPlatform/java-docs-samples/blob/HEAD/compute/cloud-client/src/main/java/compute/custommachinetype/CreateWithHelper.java" feedback-context="{&#34;language&#34;: &#34;java&#34;, &#34;region_tag&#34;: &#34;compute_custom_machine_type_create_with_helper&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/GoogleCloudPlatform/java-docs-samples/blob/HEAD/compute/cloud-client/src/main/java/compute/custommachinetype/CreateWithHelper.java&#34;}" feedback-product="1634365" feedback-bucket="infraops" language="java" data-github-path="GoogleCloudPlatform/java-docs-samples/compute/cloud-client/src/main/java/compute/custommachinetype/CreateWithHelper.java" data-git-revision="HEAD" data-region-tag="compute_custom_machine_type_create_with_helper" dir="ltr" is-upgraded syntax="Java"><code translate="no" dir="ltr"> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.compute.v1.AttachedDisk</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.compute.v1.AttachedDiskInitializeParams</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.compute.v1.InsertInstanceRequest</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.compute.v1.Instance</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.compute.v1.InstancesClient</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.compute.v1.NetworkInterface</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.compute.v1.Operation</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.common.collect.ImmutableMap</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">java.io.IOException</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">java.util.Arrays</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">java.util.Collections</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">java.util.Map</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">java.util.Objects</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">java.util.concurrent.ConcurrentHashMap</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">java.util.concurrent.ExecutionException</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">java.util.concurrent.TimeUnit</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">java.util.concurrent.TimeoutException</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">java.util.stream.IntStream</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kd">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">class</span> <span class="devsite-syntax-nc">CreateWithHelper</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// This class defines the configurable parameters for a custom VM.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">static</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">final</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">class</span> <span class="devsite-syntax-nc">TypeLimits</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-o">[]</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">allowedCores</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">minMemPerCore</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">maxMemPerCore</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">extraMemoryLimit</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">boolean</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">allowExtraMemory</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">TypeLimits</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-o">[]</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">allowedCores</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">minMemPerCore</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">maxMemPerCore</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">boolean</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">allowExtraMemory</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">extraMemoryLimit</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">allowedCores</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">allowedCores</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">minMemPerCore</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">minMemPerCore</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">maxMemPerCore</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">maxMemPerCore</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">allowExtraMemory</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">allowExtraMemory</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">extraMemoryLimit</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">extraMemoryLimit</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">enum</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">CpuSeries</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">N1</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"custom"</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">N2</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"n2-custom"</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">N2D</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"n2d-custom"</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">E2</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"e2-custom"</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">E2_MICRO</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"e2-custom-micro"</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">E2_SMALL</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"e2-custom-small"</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">E2_MEDIUM</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"e2-custom-medium"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">private</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">static</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">final</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Map&lt;String</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">CpuSeries</span>&gt;<span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">ENUM_MAP</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">static</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">ENUM_MAP</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">init</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Build an immutable map of String name to enum pairs.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">static</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Map&lt;String</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">CpuSeries</span>&gt;<span class="devsite-syntax-w"> </span><span class="devsite-syntax-nf">init</span><span class="devsite-syntax-p">()</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Map&lt;String</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">CpuSeries</span>&gt;<span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">map</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">ConcurrentHashMap</span>&lt;&gt;<span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">for</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">CpuSeries</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">instance</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">CpuSeries</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">values</span><span class="devsite-syntax-p">())</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">map</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">put</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">instance</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getCpuSeries</span><span class="devsite-syntax-p">(),</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">instance</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Collections</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">unmodifiableMap</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">map</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">private</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">final</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">cpuSeries</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">CpuSeries</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">cpuSeries</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">cpuSeries</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">cpuSeries</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">static</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">CpuSeries</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nf">get</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">name</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">ENUM_MAP</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">get</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">name</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nf">getCpuSeries</span><span class="devsite-syntax-p">()</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">cpuSeries</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// This enum correlates a machine type with its limits.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// The limits for various CPU types are described in:</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// https://cloud.google.com/compute/docs/general-purpose-machines</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">enum</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Limits</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">CPUSeries_E2</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">TypeLimits</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">getNumsInRangeWithStep</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">2</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">33</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">2</span><span class="devsite-syntax-p">),</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">512</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">8192</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">false</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">)),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">CPUSeries_E2MICRO</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">TypeLimits</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-o">[]</span><span class="devsite-syntax-p">{},</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">1024</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">2048</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">false</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">)),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">CPUSeries_E2SMALL</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">TypeLimits</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-o">[]</span><span class="devsite-syntax-p">{},</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">2048</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">4096</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">false</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">)),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">CPUSeries_E2MEDIUM</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">TypeLimits</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-o">[]</span><span class="devsite-syntax-p">{},</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">4096</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">8192</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">false</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">)),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">CPUSeries_N2</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">TypeLimits</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">concat</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">getNumsInRangeWithStep</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">2</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">33</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">2</span><span class="devsite-syntax-p">),</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">getNumsInRangeWithStep</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">36</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">129</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">4</span><span class="devsite-syntax-p">)),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">512</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">8192</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">true</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">gbToMb</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">624</span><span class="devsite-syntax-p">))),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">CPUSeries_N2D</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">TypeLimits</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-o">[]</span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-mi">2</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">4</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">8</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">16</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">32</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">48</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">64</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">80</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">96</span><span class="devsite-syntax-p">},</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">512</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">8192</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">true</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">gbToMb</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">768</span><span class="devsite-syntax-p">))),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">CPUSeries_N1</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">TypeLimits</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">concat</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-o">[]</span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-mi">1</span><span class="devsite-syntax-p">},</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">getNumsInRangeWithStep</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">2</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">97</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">2</span><span class="devsite-syntax-p">)),</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">922</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">6656</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">true</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">gbToMb</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">624</span><span class="devsite-syntax-p">)));</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">private</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">final</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">TypeLimits</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">typeLimits</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Limits</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">TypeLimits</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">typeLimits</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">typeLimits</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">typeLimits</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">TypeLimits</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nf">getTypeLimits</span><span class="devsite-syntax-p">()</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">typeLimits</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">static</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">ImmutableMap&lt;String</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Limits</span>&gt;<span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">typeLimitsMap</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">ImmutableMap</span><span class="devsite-syntax-p">.</span>&lt;<span class="devsite-syntax-na">String</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Limits&gt;builder</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">put</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"N1"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Limits</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">CPUSeries_N1</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">put</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"N2"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Limits</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">CPUSeries_N2</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">put</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"N2D"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Limits</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">CPUSeries_N2D</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">put</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"E2"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Limits</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">CPUSeries_E2</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">put</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"E2_MICRO"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Limits</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">CPUSeries_E2MICRO</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">put</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"E2_SMALL"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Limits</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">CPUSeries_E2SMALL</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">put</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"E2_MEDIUM"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Limits</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">CPUSeries_E2SMALL</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">build</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Returns the array of integers within the given range, incremented by the specified step.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// start (inclusive): starting number of the range</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// stop (inclusive): ending number of the range</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// step : increment value</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">static</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-o">[]</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nf">getNumsInRangeWithStep</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">start</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">stop</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">step</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">IntStream</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">range</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">start</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">stop</span><span class="devsite-syntax-p">).</span><span class="devsite-syntax-na">filter</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">x</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">-</span>&gt;<span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">x</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">-</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">start</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">%</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">step</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">==</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">).</span><span class="devsite-syntax-na">toArray</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">static</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nf">gbToMb</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">value</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">value</span><span class="devsite-syntax-w"> &lt;&lt; </span><span class="devsite-syntax-mi">10</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">static</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-o">[]</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nf">concat</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-o">[]</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">a</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-o">[]</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">b</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-o">[]</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">result</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-o">[</span><span class="devsite-syntax-n">a</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">length</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">b</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">length</span><span class="devsite-syntax-o">]</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">arraycopy</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">a</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">result</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">a</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">length</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">arraycopy</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">b</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">result</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">a</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">length</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">b</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">length</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">result</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">static</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">void</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nf">main</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-o">[]</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">args</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">throws</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">IOException</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">ExecutionException</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">InterruptedException</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">TimeoutException</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// TODO(developer): Replace these variables before running the sample.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Project ID or project number of the Cloud project you want to use.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">projectId</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"your-google-cloud-project-id"</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Name of the zone to create the instance in. For example: "us-west3-b".</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"google-cloud-zone"</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Name of the new virtual machine (VM) instance.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">instanceName</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"instance-name"</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">cpuSeries</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"N1"</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Number of CPU cores you want to use.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">coreCount</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">2</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// The amount of memory for the VM instance, in megabytes.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">memory</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">256</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">createInstanceWithCustomMachineTypeWithHelper</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">projectId</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">instanceName</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">cpuSeries</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">coreCount</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">memory</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Create a VM instance with a custom machine type.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">static</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">void</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nf">createInstanceWithCustomMachineTypeWithHelper</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">project</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">instanceName</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">cpuSeries</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">coreCount</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">memory</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">throws</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">IOException</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">ExecutionException</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">InterruptedException</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">TimeoutException</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Construct the URI string identifying the machine type.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">machineTypeUri</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">customMachineTypeUri</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">cpuSeries</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">coreCount</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">memory</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Initialize client that will be used to send requests. This client only needs to be created</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// once, and can be reused for multiple requests. After completing all of your requests, call</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// the `instancesClient.close()` method on the client to safely</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// clean up any remaining background resources.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">try</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">InstancesClient</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">instancesClient</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">InstancesClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">create</span><span class="devsite-syntax-p">())</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">AttachedDisk</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">attachedDisk</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">AttachedDisk</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">newBuilder</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setInitializeParams</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Describe the size and source image of the boot disk to attach to the instance.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// The list of public images available in Compute Engine can be found here:</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// https://cloud.google.com/compute/docs/images#list_of_public_images_available_on</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">AttachedDiskInitializeParams</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">newBuilder</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setSourceImage</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">format</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"projects/%s/global/images/family/%s"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"debian-cloud"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"debian-11"</span><span class="devsite-syntax-p">))</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setDiskSizeGb</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">10</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">build</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Remember to set auto_delete to True if you want the disk to be deleted when you delete</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// your VM instance.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setAutoDelete</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-kc">true</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setBoot</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-kc">true</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">build</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Create the Instance object with the relevant information.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Instance</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">instance</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Instance</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">newBuilder</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setName</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">instanceName</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">addDisks</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">attachedDisk</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setMachineType</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">machineTypeUri</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">addNetworkInterfaces</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">NetworkInterface</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">newBuilder</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-na">setName</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"global/networks/default"</span><span class="devsite-syntax-p">).</span><span class="devsite-syntax-na">build</span><span class="devsite-syntax-p">())</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">build</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Create the insert instance request object.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">InsertInstanceRequest</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">insertInstanceRequest</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">InsertInstanceRequest</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">newBuilder</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setProject</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">project</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setZone</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setInstanceResource</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">instance</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">build</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Invoke the API with the request object and wait for the operation to complete.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Operation</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">response</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">instancesClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">insertAsync</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">insertInstanceRequest</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">get</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">3</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">TimeUnit</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">MINUTES</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Check for errors.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">response</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">hasError</span><span class="devsite-syntax-p">())</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">throw</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Error</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Instance creation failed!!"</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">response</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">printf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Instance created : %s"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">instanceName</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Operation Status: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">response</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getStatus</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">static</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nf">customMachineTypeUri</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">cpuSeries</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">coreCount</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">memory</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-o">!</span><span class="devsite-syntax-n">Arrays</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">asList</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">CpuSeries</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">E2</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">cpuSeries</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">CpuSeries</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">N1</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">cpuSeries</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">CpuSeries</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">N2</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">cpuSeries</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">CpuSeries</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">N2D</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">cpuSeries</span><span class="devsite-syntax-p">).</span><span class="devsite-syntax-na">contains</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">cpuSeries</span><span class="devsite-syntax-p">))</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">throw</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Error</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">format</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Incorrect cpu type: %s"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">cpuSeries</span><span class="devsite-syntax-p">));</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">TypeLimits</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">typeLimit</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Objects</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">requireNonNull</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">typeLimitsMap</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">get</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">CpuSeries</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">get</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">cpuSeries</span><span class="devsite-syntax-p">).</span><span class="devsite-syntax-na">name</span><span class="devsite-syntax-p">())).</span><span class="devsite-syntax-na">typeLimits</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Perform the following checks to verify if the requested parameters are allowed.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Find more information about limitations of custom machine types at:</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// https://cloud.google.com/compute/docs/general-purpose-machines#custom_machine_types</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// 1. Check the number of cores and if the coreCount is present in allowedCores.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">typeLimit</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">allowedCores</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">length</span><span class="devsite-syntax-w"> &gt; </span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-w"> &amp;&amp; </span><span class="devsite-syntax-n">Arrays</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">stream</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">typeLimit</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">allowedCores</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">noneMatch</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">x</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">-</span>&gt;<span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">x</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">==</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">coreCount</span><span class="devsite-syntax-p">))</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">throw</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Error</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">format</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"Invalid number of cores requested. "</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"Number of cores requested for CPU %s should be one of: %s"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">cpuSeries</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Arrays</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">toString</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">typeLimit</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">allowedCores</span><span class="devsite-syntax-p">)));</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// 2. Memory must be a multiple of 256 MB</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">memory</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">%</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">256</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">throw</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Error</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Requested memory must be a multiple of 256 MB"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// 3. Check if the requested memory isn't too little</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">memory</span><span class="devsite-syntax-w"> &lt; </span><span class="devsite-syntax-n">coreCount</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">*</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">typeLimit</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">minMemPerCore</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">throw</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Error</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">format</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Requested memory is too low. Minimum memory for %s is %s MB per core"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">cpuSeries</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">typeLimit</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">minMemPerCore</span><span class="devsite-syntax-p">));</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// 4. Check if the requested memory isn't too much</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">memory</span><span class="devsite-syntax-w"> &gt; </span><span class="devsite-syntax-n">coreCount</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">*</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">typeLimit</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">maxMemPerCore</span><span class="devsite-syntax-w"> &amp;&amp; </span><span class="devsite-syntax-o">!</span><span class="devsite-syntax-n">typeLimit</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">allowExtraMemory</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">throw</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Error</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">format</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"Requested memory is too large.. Maximum memory allowed for %s is %s MB per core"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">cpuSeries</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">typeLimit</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">extraMemoryLimit</span><span class="devsite-syntax-p">));</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// 5. Check if the requested memory isn't too large</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">memory</span><span class="devsite-syntax-w"> &gt; </span><span class="devsite-syntax-n">typeLimit</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">extraMemoryLimit</span><span class="devsite-syntax-w"> &amp;&amp; </span><span class="devsite-syntax-n">typeLimit</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">allowExtraMemory</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">throw</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Error</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">format</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Requested memory is too large.. Maximum memory allowed for %s is %s MB"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">cpuSeries</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">typeLimit</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">extraMemoryLimit</span><span class="devsite-syntax-p">));</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Check if the CPU Series is E2 and return the custom machine type in the form of a string</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// acceptable by Compute Engine API.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">Arrays</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">asList</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">CpuSeries</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">E2_SMALL</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">cpuSeries</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">CpuSeries</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">E2_MICRO</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">cpuSeries</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">CpuSeries</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">E2_MEDIUM</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">cpuSeries</span><span class="devsite-syntax-p">).</span><span class="devsite-syntax-na">contains</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">cpuSeries</span><span class="devsite-syntax-p">))</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">format</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"zones/%s/machineTypes/%s-%s"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">cpuSeries</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">memory</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Check if extended memory was requested and return the extended custom machine type</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// in the form of a string acceptable by Compute Engine API.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">memory</span><span class="devsite-syntax-w"> &gt; </span><span class="devsite-syntax-n">coreCount</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">*</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">typeLimit</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">maxMemPerCore</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">format</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"zones/%s/machineTypes/%s-%s-%s-ext"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">cpuSeries</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">coreCount</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">memory</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Return the custom machine type in the form of a standard string</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// acceptable by Compute Engine API.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">format</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"zones/%s/machineTypes/%s-%s-%s"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">cpuSeries</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">coreCount</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">memory</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-p">}</span></code></pre></devsite-code> </div> </section> </section> <section><h3 id="node.js" data-text=" Node.js " tabindex="-1"> Node.js </h3> <section> <p> Before trying this sample, follow the <span class="notranslate">Node.js</span> setup instructions in the <a href="/compute/docs/api/using-libraries" track-type="clientLibrariesQuickstart" track-name="nodejs" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob//compute/instances/custom-machine-type/createWithHelper.js" track-metadata-position="compute_custom_machine_type_create_with_helper">Compute Engine quickstart using client libraries</a>. For more information, see the <a href="/nodejs/docs/reference/compute/latest" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="nodejs" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob//compute/instances/custom-machine-type/createWithHelper.js" track-metadata-region-tag="compute_custom_machine_type_create_with_helper">Compute Engine <span class="notranslate">Node.js</span> API reference documentation</a>. </p> <p> To authenticate to Compute Engine, set up Application Default Credentials. For more information, see <a href="/docs/authentication/provide-credentials-adc#local-dev">Set up authentication for a local development environment</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="GoogleCloudPlatform/nodejs-docs-samples/compute/instances/custom-machine-type/createWithHelper.js/HEAD/compute_custom_machine_type_create_with_helper" data-code-snippet="true" data-github-includecode-link="https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/HEAD/compute/instances/custom-machine-type/createWithHelper.js" feedback-context="{&#34;language&#34;: &#34;nodejs&#34;, &#34;region_tag&#34;: &#34;compute_custom_machine_type_create_with_helper&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/HEAD/compute/instances/custom-machine-type/createWithHelper.js&#34;}" feedback-product="1634365" feedback-bucket="infraops" language="nodejs" data-github-path="GoogleCloudPlatform/nodejs-docs-samples/compute/instances/custom-machine-type/createWithHelper.js" data-git-revision="HEAD" data-region-tag="compute_custom_machine_type_create_with_helper" dir="ltr" is-upgraded syntax="JavaScript"><code translate="no" dir="ltr"><span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * TODO(developer): Uncomment and replace these variables before running the sample.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-c1">// const projectId = 'YOUR_PROJECT_ID';</span> <span class="devsite-syntax-c1">// const zone = 'europe-central2-b';</span> <span class="devsite-syntax-c1">// const instanceName = 'YOUR_INSTANCE_NAME';</span> <span class="devsite-syntax-c1">// const cpuSeries = 'N1';</span> <span class="devsite-syntax-c1">// const coreCount = 2</span> <span class="devsite-syntax-c1">// const memory = 256</span> <span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">compute</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">require</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s1">'@google-cloud/compute'</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-kd">function</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">range</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-kr">from</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">to</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">step</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[...</span><span class="devsite-syntax-nb">Array</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nb">Math</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">floor</span><span class="devsite-syntax-p">((</span><span class="devsite-syntax-nx">to</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">-</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kr">from</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">/</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">step</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">1</span><span class="devsite-syntax-p">)].</span><span class="devsite-syntax-nx">map</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">_</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">i</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span>&gt;<span class="devsite-syntax-w"> </span><span class="devsite-syntax-kr">from</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">i</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">*</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">step</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-p">}</span> <span class="devsite-syntax-kd">class</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">CustomMachineType</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kr">constructor</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">coreCount</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">memory</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">coreCount</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">coreCount</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">memory</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">memory</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">N1</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'custom'</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">N2</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'n2-custom'</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">N2D</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'n2d-custom'</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">E2</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'e2-custom'</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">E2Micro</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'e2-custom-micro'</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">E2Small</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'e2-custom-small'</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">E2Medium</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'e2-custom-medium'</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">CpuSeriesE2Limit</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">allowedCores</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">range</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mf">2</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">33</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">2</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">minMemPerCore</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">512</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">maxMemPerCore</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">8192</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">allowExtraMemory</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">false</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">extraMemoryLimit</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">0</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">};</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">CpuSeriesE2MicroLimit</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">allowedCores</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[],</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">minMemPerCore</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">1024</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">maxMemPerCore</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">2048</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">allowExtraMemory</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">false</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">extraMemoryLimit</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">0</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">};</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">CpuSeriesE2SmallLimit</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">allowedCores</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[],</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">minMemPerCore</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">2048</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">maxMemPerCore</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">4096</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">allowExtraMemory</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">false</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">extraMemoryLimit</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">0</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">};</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">CpuSeriesE2MediumLimit</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">allowedCores</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[],</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">minMemPerCore</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">4096</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">maxMemPerCore</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">8192</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">allowExtraMemory</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">false</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">extraMemoryLimit</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">0</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">};</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">CpuSeriesN2Limit</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">allowedCores</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[...</span><span class="devsite-syntax-nx">range</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mf">2</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">33</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">2</span><span class="devsite-syntax-p">),</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">...</span><span class="devsite-syntax-nx">range</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mf">36</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">129</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">4</span><span class="devsite-syntax-p">)],</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">minMemPerCore</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">512</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">maxMemPerCore</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">8192</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">allowExtraMemory</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">true</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">extraMemoryLimit</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">624</span><span class="devsite-syntax-w"> &lt;&lt; </span><span class="devsite-syntax-mf">10</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">};</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">CpuSeriesN2DLimit</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">allowedCores</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mf">2</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">4</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">8</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">16</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">32</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">48</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">64</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">80</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">96</span><span class="devsite-syntax-p">],</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">minMemPerCore</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">512</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">maxMemPerCore</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">8192</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">allowExtraMemory</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">true</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">extraMemoryLimit</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">768</span><span class="devsite-syntax-w"> &lt;&lt; </span><span class="devsite-syntax-mf">10</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">};</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">CpuSeriesN1Limit</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">allowedCores</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-mf">1</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">range</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mf">2</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">97</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">2</span><span class="devsite-syntax-p">)],</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">minMemPerCore</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">922</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">maxMemPerCore</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">6656</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">allowExtraMemory</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">true</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">extraMemoryLimit</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">624</span><span class="devsite-syntax-w"> &lt;&lt; </span><span class="devsite-syntax-mf">10</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">};</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">TYPE_LIMITS</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">N1</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">CpuSeriesN1Limit</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">N2</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">CpuSeriesN2Limit</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">N2D</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">CpuSeriesN2DLimit</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">E2</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">CpuSeriesE2Limit</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">E2Micro</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">CpuSeriesE2MicroLimit</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">E2Small</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">CpuSeriesE2SmallLimit</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">E2Medium</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">CpuSeriesE2MediumLimit</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">};</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-o">!</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">E2</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">N1</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">N2</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">N2D</span><span class="devsite-syntax-p">].</span><span class="devsite-syntax-nx">includes</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-p">))</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">throw</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ow">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ne">Error</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sb">`Incorrect CPU type: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">typeLimit</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">TYPE_LIMITS</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-p">];</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Check whether the requested parameters are allowed.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Find more information about limitations of custom machine types at:</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// https://cloud.google.com/compute/docs/general-purpose-machines#custom_machine_types</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Check the number of cores</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">typeLimit</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">allowedCores</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">length</span><span class="devsite-syntax-w"> &gt; </span><span class="devsite-syntax-mf">0</span><span class="devsite-syntax-w"> </span>&amp;&amp; <span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">typeLimit</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">allowedCores</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">includes</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">coreCount</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">throw</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ow">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ne">Error</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sb">`Invalid number of cores requested. Allowed number of cores for </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb"> is: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">typeLimit</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">allowedCores</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Memory must be a multiple of 256 MB</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">memory</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">%</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">256</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!==</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">0</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">throw</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ow">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ne">Error</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s1">'Requested memory must be a multiple of 256 MB'</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Check if the requested memory isn't too little</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">memory</span><span class="devsite-syntax-w"> &lt; </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">coreCount</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">*</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">typeLimit</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">minMemPerCore</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">throw</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ow">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ne">Error</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sb">`Requested memory is too low. Minimal memory for </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb"> is </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">typeLimit</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">minMemPerCore</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb"> MB per core`</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Check if the requested memory isn't too much</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">memory</span><span class="devsite-syntax-w"> &gt; </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">coreCount</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">*</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">typeLimit</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">maxMemPerCore</span><span class="devsite-syntax-w"> </span>&amp;&amp; <span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">typeLimit</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">allowExtraMemory</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">throw</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ow">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ne">Error</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sb">`Requested memory is too large.. Maximum memory allowed for </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb"> is </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">typeLimit</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">maxMemPerCore</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb"> MB per core`</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">memory</span><span class="devsite-syntax-w"> &gt; </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">typeLimit</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">extraMemoryLimit</span><span class="devsite-syntax-w"> </span>&amp;&amp; <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">typeLimit</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">allowExtraMemory</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">throw</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ow">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ne">Error</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sb">`Requested memory is too large.. Maximum memory allowed for </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb"> is </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">typeLimit</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">extraMemoryLimit</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb"> MB`</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Returns the custom machine type in form of a string acceptable by Compute Engine API.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">getMachineTypeURI</span><span class="devsite-syntax-p">()</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">E2Small</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">E2Micro</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">E2Medium</span><span class="devsite-syntax-p">].</span><span class="devsite-syntax-nx">includes</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-sb">`zones/</span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">/machineTypes/</span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">-</span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">memory</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">memory</span><span class="devsite-syntax-w"> &gt; </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">coreCount</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">*</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">typeLimit</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">maxMemPerCore</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-sb">`zones/</span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">/machineTypes/</span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">-</span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">coreCount</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">-</span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">memory</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">-ext`</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-sb">`zones/</span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">/machineTypes/</span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">-</span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">coreCount</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">-</span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-k">this</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">memory</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-p">}</span> <span class="devsite-syntax-k">async</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">function</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">createInstanceWithCustomMachineTypeWithHelper</span><span class="devsite-syntax-p">()</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instancesClient</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ow">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">compute</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">InstancesClient</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">machineType</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ow">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">CustomMachineType</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">coreCount</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">memory</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">).</span><span class="devsite-syntax-nx">getMachineTypeURI</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-nx">response</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">await</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instancesClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">insert</span><span class="devsite-syntax-p">({</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instanceResource</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">name</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instanceName</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">disks</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">initializeParams</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">diskSizeGb</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'64'</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">sourceImage</span><span class="devsite-syntax-o">:</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'projects/debian-cloud/global/images/family/debian-11/'</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">autoDelete</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">true</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">boot</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">true</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">],</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">machineType</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">networkInterfaces</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">name</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'global/networks/default'</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">],</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">project</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">projectId</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">});</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">let</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">operation</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">response</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">latestResponse</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">operationsClient</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ow">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">compute</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">ZoneOperationsClient</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Wait for the create operation to complete.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">while</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">operation</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">status</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!==</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'DONE'</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-nx">operation</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">await</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">operationsClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">wait</span><span class="devsite-syntax-p">({</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">operation</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">operation</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">name</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">project</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">projectId</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">operation</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">split</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s1">'/'</span><span class="devsite-syntax-p">).</span><span class="devsite-syntax-nx">pop</span><span class="devsite-syntax-p">(),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">});</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s1">'Instance created.'</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-p">}</span> <span class="devsite-syntax-nx">createInstanceWithCustomMachineTypeWithHelper</span><span class="devsite-syntax-p">();</span></code></pre></devsite-code> </div> </section> </section> <section><h3 id="python" data-text=" Python " tabindex="-1"> Python </h3> <section> <p> Before trying this sample, follow the <span class="notranslate">Python</span> setup instructions in the <a href="/compute/docs/api/using-libraries" track-type="clientLibrariesQuickstart" track-name="python" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/python-docs-samples/blob//compute/client_library/snippets/instances/custom_machine_types/create_with_helper.py" track-metadata-position="compute_custom_machine_type_create_with_helper">Compute Engine quickstart using client libraries</a>. For more information, see the <a href="/python/docs/reference/compute/latest" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="python" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/python-docs-samples/blob//compute/client_library/snippets/instances/custom_machine_types/create_with_helper.py" track-metadata-region-tag="compute_custom_machine_type_create_with_helper">Compute Engine <span class="notranslate">Python</span> API reference documentation</a>. </p> <p> To authenticate to Compute Engine, set up Application Default Credentials. For more information, see <a href="/docs/authentication/provide-credentials-adc#local-dev">Set up authentication for a local development environment</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="GoogleCloudPlatform/python-docs-samples/compute/client_library/snippets/instances/custom_machine_types/create_with_helper.py/HEAD/compute_custom_machine_type_create_with_helper" data-code-snippet="true" data-github-includecode-link="https://github.com/GoogleCloudPlatform/python-docs-samples/blob/HEAD/compute/client_library/snippets/instances/custom_machine_types/create_with_helper.py" feedback-context="{&#34;language&#34;: &#34;python&#34;, &#34;region_tag&#34;: &#34;compute_custom_machine_type_create_with_helper&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/GoogleCloudPlatform/python-docs-samples/blob/HEAD/compute/client_library/snippets/instances/custom_machine_types/create_with_helper.py&#34;}" feedback-product="1634365" feedback-bucket="infraops" language="python" data-github-path="GoogleCloudPlatform/python-docs-samples/compute/client_library/snippets/instances/custom_machine_types/create_with_helper.py" data-git-revision="HEAD" data-region-tag="compute_custom_machine_type_create_with_helper" dir="ltr" is-upgraded syntax="Python"><code translate="no" dir="ltr"><span class="devsite-syntax-kn">from</span> <span class="devsite-syntax-nn">__future__</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-n">annotations</span> <span class="devsite-syntax-kn">from</span> <span class="devsite-syntax-nn">collections</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-n">namedtuple</span> <span class="devsite-syntax-kn">from</span> <span class="devsite-syntax-nn">enum</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-n">Enum</span> <span class="devsite-syntax-kn">from</span> <span class="devsite-syntax-nn">enum</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-n">unique</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-nn">re</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-nn">sys</span> <span class="devsite-syntax-kn">from</span> <span class="devsite-syntax-nn">typing</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-n">Any</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-nn">warnings</span> <span class="devsite-syntax-kn">from</span> <span class="devsite-syntax-nn">google.api_core.extended_operation</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-n">ExtendedOperation</span> <span class="devsite-syntax-kn">from</span> <span class="devsite-syntax-nn">google.cloud</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-n">compute_v1</span> <span class="devsite-syntax-k">def</span> <span class="devsite-syntax-nf">gb_to_mb</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">value</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">int</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-o">-</span>&gt; <span class="devsite-syntax-nb">int</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-k">return</span> <span class="devsite-syntax-n">value</span> &lt;&lt; <span class="devsite-syntax-mi">10</span> <span class="devsite-syntax-k">class</span> <span class="devsite-syntax-nc">CustomMachineType</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sd">"""</span> <span class="devsite-syntax-sd"> Allows to create custom machine types to be used with the VM instances.</span> <span class="devsite-syntax-sd"> """</span> <span class="devsite-syntax-nd">@unique</span> <span class="devsite-syntax-k">class</span> <span class="devsite-syntax-nc">CPUSeries</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">Enum</span><span class="devsite-syntax-p">):</span> <span class="devsite-syntax-n">N1</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-s2">"custom"</span> <span class="devsite-syntax-n">N2</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-s2">"n2-custom"</span> <span class="devsite-syntax-n">N2D</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-s2">"n2d-custom"</span> <span class="devsite-syntax-n">E2</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-s2">"e2-custom"</span> <span class="devsite-syntax-n">E2_MICRO</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-s2">"e2-custom-micro"</span> <span class="devsite-syntax-n">E2_SMALL</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-s2">"e2-custom-small"</span> <span class="devsite-syntax-n">E2_MEDIUM</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-s2">"e2-custom-medium"</span> <span class="devsite-syntax-n">TypeLimits</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">namedtuple</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-s2">"TypeLimits"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">[</span> <span class="devsite-syntax-s2">"allowed_cores"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"min_mem_per_core"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"max_mem_per_core"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"allow_extra_memory"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"extra_memory_limit"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">],</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># The limits for various CPU types are described on:</span> <span class="devsite-syntax-c1"># https://cloud.google.com/compute/docs/general-purpose-machines</span> <span class="devsite-syntax-n">LIMITS</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-p">{</span> <span class="devsite-syntax-n">CPUSeries</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">E2</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">TypeLimits</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nb">frozenset</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nb">range</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">2</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-mi">33</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-mi">2</span><span class="devsite-syntax-p">)),</span> <span class="devsite-syntax-mi">512</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-mi">8192</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-kc">False</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-n">CPUSeries</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">E2_MICRO</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">TypeLimits</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nb">frozenset</span><span class="devsite-syntax-p">(),</span> <span class="devsite-syntax-mi">1024</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-mi">2048</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-kc">False</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-n">CPUSeries</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">E2_SMALL</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">TypeLimits</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nb">frozenset</span><span class="devsite-syntax-p">(),</span> <span class="devsite-syntax-mi">2048</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-mi">4096</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-kc">False</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-n">CPUSeries</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">E2_MEDIUM</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">TypeLimits</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nb">frozenset</span><span class="devsite-syntax-p">(),</span> <span class="devsite-syntax-mi">4096</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-mi">8192</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-kc">False</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-n">CPUSeries</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">N2</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">TypeLimits</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-nb">frozenset</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nb">range</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">2</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-mi">33</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-mi">2</span><span class="devsite-syntax-p">))</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">union</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nb">set</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nb">range</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">36</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-mi">129</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-mi">4</span><span class="devsite-syntax-p">))),</span> <span class="devsite-syntax-mi">512</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-mi">8192</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-kc">True</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">gb_to_mb</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">624</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-p">),</span> <span class="devsite-syntax-n">CPUSeries</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">N2D</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">TypeLimits</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-nb">frozenset</span><span class="devsite-syntax-p">({</span><span class="devsite-syntax-mi">2</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-mi">4</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-mi">8</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-mi">16</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-mi">32</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-mi">48</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-mi">64</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-mi">80</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-mi">96</span><span class="devsite-syntax-p">}),</span> <span class="devsite-syntax-mi">512</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-mi">8192</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-kc">True</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">gb_to_mb</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">768</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-p">),</span> <span class="devsite-syntax-n">CPUSeries</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">N1</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">TypeLimits</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-nb">frozenset</span><span class="devsite-syntax-p">({</span><span class="devsite-syntax-mi">1</span><span class="devsite-syntax-p">}</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">union</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nb">range</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">2</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-mi">97</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-mi">2</span><span class="devsite-syntax-p">))),</span> <span class="devsite-syntax-mi">922</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-mi">6656</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-kc">True</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">gb_to_mb</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">624</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-p">),</span> <span class="devsite-syntax-p">}</span> <span class="devsite-syntax-k">def</span> <span class="devsite-syntax-fm">__init__</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">cpu_series</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">CPUSeries</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">memory_mb</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">int</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">core_count</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">int</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-mi">0</span> <span class="devsite-syntax-p">):</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">zone</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">zone</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">cpu_series</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">cpu_series</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">limits</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">LIMITS</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">cpu_series</span><span class="devsite-syntax-p">]</span> <span class="devsite-syntax-c1"># Shared machine types (e2-small, e2-medium and e2-micro) always have</span> <span class="devsite-syntax-c1"># 2 vCPUs: https://cloud.google.com/compute/docs/general-purpose-machines#e2_limitations</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">core_count</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-mi">2</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">is_shared</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-k">else</span> <span class="devsite-syntax-n">core_count</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">memory_mb</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">memory_mb</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">_checked</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-kc">False</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">_check_parameters</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">extra_memory_used</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">_check_extra_memory</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-k">def</span> <span class="devsite-syntax-nf">is_shared</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-bp">self</span><span class="devsite-syntax-p">):</span> <span class="devsite-syntax-k">return</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">cpu_series</span> <span class="devsite-syntax-ow">in</span> <span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">CustomMachineType</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">CPUSeries</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">E2_SMALL</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">CustomMachineType</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">CPUSeries</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">E2_MICRO</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">CustomMachineType</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">CPUSeries</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">E2_MEDIUM</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">def</span> <span class="devsite-syntax-nf">_check_extra_memory</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-bp">self</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-o">-</span>&gt; <span class="devsite-syntax-nb">bool</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">_checked</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-k">return</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">memory_mb</span> &gt; <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">core_count</span> <span class="devsite-syntax-o">*</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">limits</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">max_mem_per_core</span> <span class="devsite-syntax-k">else</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-k">raise</span> <span class="devsite-syntax-ne">RuntimeError</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-s2">"You need to call _check_parameters() before calling _check_extra_memory()"</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">def</span> <span class="devsite-syntax-nf">_check_parameters</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-bp">self</span><span class="devsite-syntax-p">):</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sd">"""</span> <span class="devsite-syntax-sd"> Check whether the requested parameters are allowed. Find more information about limitations of custom machine</span> <span class="devsite-syntax-sd"> types at: https://cloud.google.com/compute/docs/general-purpose-machines#custom_machine_types</span> <span class="devsite-syntax-sd"> """</span> <span class="devsite-syntax-c1"># Check the number of cores</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-p">(</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">limits</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">allowed_cores</span> <span class="devsite-syntax-ow">and</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">core_count</span> <span class="devsite-syntax-ow">not</span> <span class="devsite-syntax-ow">in</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">limits</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">allowed_cores</span> <span class="devsite-syntax-p">):</span> <span class="devsite-syntax-k">raise</span> <span class="devsite-syntax-ne">RuntimeError</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Invalid number of cores requested. Allowed number of cores for </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">cpu_series</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2"> is: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-nb">sorted</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">limits</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">allowed_cores</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Memory must be a multiple of 256 MB</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">memory_mb</span> <span class="devsite-syntax-o">%</span> <span class="devsite-syntax-mi">256</span> <span class="devsite-syntax-o">!=</span> <span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-k">raise</span> <span class="devsite-syntax-ne">RuntimeError</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s2">"Requested memory must be a multiple of 256 MB."</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Check if the requested memory isn't too little</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">memory_mb</span> &lt; <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">core_count</span> <span class="devsite-syntax-o">*</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">limits</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">min_mem_per_core</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-k">raise</span> <span class="devsite-syntax-ne">RuntimeError</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Requested memory is too low. Minimal memory for </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">cpu_series</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2"> is </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">limits</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">min_mem_per_core</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2"> MB per core."</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Check if the requested memory isn't too much</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">memory_mb</span> &gt; <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">core_count</span> <span class="devsite-syntax-o">*</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">limits</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">max_mem_per_core</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">limits</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">allow_extra_memory</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">memory_mb</span> &gt; <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">limits</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">extra_memory_limit</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-k">raise</span> <span class="devsite-syntax-ne">RuntimeError</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Requested memory is too large.. Maximum memory allowed for </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">cpu_series</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2"> is </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">limits</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">extra_memory_limit</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2"> MB."</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">else</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-k">raise</span> <span class="devsite-syntax-ne">RuntimeError</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Requested memory is too large.. Maximum memory allowed for </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">cpu_series</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2"> is </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">limits</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">max_mem_per_core</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2"> MB per core."</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">_checked</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-kc">True</span> <span class="devsite-syntax-k">def</span> <span class="devsite-syntax-fm">__str__</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-bp">self</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-o">-</span>&gt; <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sd">"""</span> <span class="devsite-syntax-sd"> Return the custom machine type in form of a string acceptable by Compute Engine API.</span> <span class="devsite-syntax-sd"> """</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">cpu_series</span> <span class="devsite-syntax-ow">in</span> <span class="devsite-syntax-p">{</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">CPUSeries</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">E2_SMALL</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">CPUSeries</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">E2_MICRO</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">CPUSeries</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">E2_MEDIUM</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">}:</span> <span class="devsite-syntax-k">return</span> <span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"zones/</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">/machineTypes/</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">cpu_series</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">value</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">-</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">memory_mb</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">extra_memory_used</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-k">return</span> <span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"zones/</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">/machineTypes/</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">cpu_series</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">value</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">-</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">core_count</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">-</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">memory_mb</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">-ext"</span> <span class="devsite-syntax-k">return</span> <span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"zones/</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">/machineTypes/</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">cpu_series</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">value</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">-</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">core_count</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">-</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-bp">self</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">memory_mb</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span> <span class="devsite-syntax-k">def</span> <span class="devsite-syntax-nf">short_type_str</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-bp">self</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-o">-</span>&gt; <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sd">"""</span> <span class="devsite-syntax-sd"> Return machine type in a format without the zone. For example, n2-custom-0-10240.</span> <span class="devsite-syntax-sd"> This format is used to create instance templates.</span> <span class="devsite-syntax-sd"> """</span> <span class="devsite-syntax-k">return</span> <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-bp">self</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">rsplit</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s2">"/"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">maxsplit</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-mi">1</span><span class="devsite-syntax-p">)[</span><span class="devsite-syntax-mi">1</span><span class="devsite-syntax-p">]</span> <span class="devsite-syntax-nd">@classmethod</span> <span class="devsite-syntax-k">def</span> <span class="devsite-syntax-nf">from_str</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-bp">cls</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">machine_type</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">):</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sd">"""</span> <span class="devsite-syntax-sd"> Construct a new object from a string. The string needs to be a valid custom machine type like:</span> <span class="devsite-syntax-sd"> - https://www.googleapis.com/compute/v1/projects/diregapic-mestiv/zones/us-central1-b/machineTypes/e2-custom-4-8192</span> <span class="devsite-syntax-sd"> - zones/us-central1-b/machineTypes/e2-custom-4-8192</span> <span class="devsite-syntax-sd"> - e2-custom-4-8192 (in this case, the zone parameter will not be set)</span> <span class="devsite-syntax-sd"> """</span> <span class="devsite-syntax-n">zone</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-kc">None</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">machine_type</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">startswith</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s2">"http"</span><span class="devsite-syntax-p">):</span> <span class="devsite-syntax-n">machine_type</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">machine_type</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-n">machine_type</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">find</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s2">"zones/"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-p">:]</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">machine_type</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">startswith</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s2">"zones/"</span><span class="devsite-syntax-p">):</span> <span class="devsite-syntax-n">_</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">_</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">machine_type</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">machine_type</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">split</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s2">"/"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-n">extra_mem</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">machine_type</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">endswith</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s2">"-ext"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">machine_type</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">startswith</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s2">"custom"</span><span class="devsite-syntax-p">):</span> <span class="devsite-syntax-n">cpu</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-bp">cls</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">CPUSeries</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">N1</span> <span class="devsite-syntax-n">_</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">cores</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">memory</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">machine_type</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">rsplit</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s2">"-"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">maxsplit</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-mi">2</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">else</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">extra_mem</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">cpu_series</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">_</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">cores</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">memory</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">_</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">machine_type</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">split</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s2">"-"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">else</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">cpu_series</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">_</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">cores</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">memory</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">machine_type</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">split</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s2">"-"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">cpu_series</span> <span class="devsite-syntax-o">==</span> <span class="devsite-syntax-s2">"n2"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">cpu</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-bp">cls</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">CPUSeries</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">N2</span> <span class="devsite-syntax-k">elif</span> <span class="devsite-syntax-n">cpu_series</span> <span class="devsite-syntax-o">==</span> <span class="devsite-syntax-s2">"n2d"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">cpu</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-bp">cls</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">CPUSeries</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">N2D</span> <span class="devsite-syntax-k">elif</span> <span class="devsite-syntax-n">cpu_series</span> <span class="devsite-syntax-o">==</span> <span class="devsite-syntax-s2">"e2"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">cpu</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-bp">cls</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">CPUSeries</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">E2</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">cores</span> <span class="devsite-syntax-o">==</span> <span class="devsite-syntax-s2">"micro"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">cpu</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-bp">cls</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">CPUSeries</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">E2_MICRO</span> <span class="devsite-syntax-n">cores</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-mi">2</span> <span class="devsite-syntax-k">elif</span> <span class="devsite-syntax-n">cores</span> <span class="devsite-syntax-o">==</span> <span class="devsite-syntax-s2">"small"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">cpu</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-bp">cls</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">CPUSeries</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">E2_SMALL</span> <span class="devsite-syntax-n">cores</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-mi">2</span> <span class="devsite-syntax-k">elif</span> <span class="devsite-syntax-n">cores</span> <span class="devsite-syntax-o">==</span> <span class="devsite-syntax-s2">"medium"</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">cpu</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-bp">cls</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">CPUSeries</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">E2_MEDIUM</span> <span class="devsite-syntax-n">cores</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-mi">2</span> <span class="devsite-syntax-k">else</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-k">raise</span> <span class="devsite-syntax-ne">RuntimeError</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s2">"Unknown CPU series."</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-n">cores</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-nb">int</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">cores</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-n">memory</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-nb">int</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">memory</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">return</span> <span class="devsite-syntax-bp">cls</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">cpu</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">memory</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">cores</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">def</span> <span class="devsite-syntax-nf">get_image_from_family</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">project</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">family</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-o">-</span>&gt; <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">Image</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sd">"""</span> <span class="devsite-syntax-sd"> Retrieve the newest image that is part of a given family in a project.</span> <span class="devsite-syntax-sd"> Args:</span> <span class="devsite-syntax-sd"> project: project ID or project number of the Cloud project you want to get image from.</span> <span class="devsite-syntax-sd"> family: name of the image family you want to get image from.</span> <span class="devsite-syntax-sd"> Returns:</span> <span class="devsite-syntax-sd"> An Image object.</span> <span class="devsite-syntax-sd"> """</span> <span class="devsite-syntax-n">image_client</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">ImagesClient</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-c1"># List of public operating system (OS) images: https://cloud.google.com/compute/docs/images/os-details</span> <span class="devsite-syntax-n">newest_image</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">image_client</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">get_from_family</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">project</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">project</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">family</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">family</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">return</span> <span class="devsite-syntax-n">newest_image</span> <span class="devsite-syntax-k">def</span> <span class="devsite-syntax-nf">disk_from_image</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">disk_type</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">disk_size_gb</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">int</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">boot</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">bool</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">source_image</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">auto_delete</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">bool</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-kc">True</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-o">-</span>&gt; <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">AttachedDisk</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sd">"""</span> <span class="devsite-syntax-sd"> Create an AttachedDisk object to be used in VM instance creation. Uses an image as the</span> <span class="devsite-syntax-sd"> source for the new disk.</span> <span class="devsite-syntax-sd"> Args:</span> <span class="devsite-syntax-sd"> disk_type: the type of disk you want to create. This value uses the following format:</span> <span class="devsite-syntax-sd"> "zones/{zone}/diskTypes/(pd-standard|pd-ssd|pd-balanced|pd-extreme)".</span> <span class="devsite-syntax-sd"> For example: "zones/us-west3-b/diskTypes/pd-ssd"</span> <span class="devsite-syntax-sd"> disk_size_gb: size of the new disk in gigabytes</span> <span class="devsite-syntax-sd"> boot: boolean flag indicating whether this disk should be used as a boot disk of an instance</span> <span class="devsite-syntax-sd"> source_image: source image to use when creating this disk. You must have read access to this disk. This can be one</span> <span class="devsite-syntax-sd"> of the publicly available images or an image from one of your projects.</span> <span class="devsite-syntax-sd"> This value uses the following format: "projects/{project_name}/global/images/{image_name}"</span> <span class="devsite-syntax-sd"> auto_delete: boolean flag indicating whether this disk should be deleted with the VM that uses it</span> <span class="devsite-syntax-sd"> Returns:</span> <span class="devsite-syntax-sd"> AttachedDisk object configured to be created using the specified image.</span> <span class="devsite-syntax-sd"> """</span> <span class="devsite-syntax-n">boot_disk</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">AttachedDisk</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-n">initialize_params</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">AttachedDiskInitializeParams</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-n">initialize_params</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">source_image</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">source_image</span> <span class="devsite-syntax-n">initialize_params</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">disk_size_gb</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">disk_size_gb</span> <span class="devsite-syntax-n">initialize_params</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">disk_type</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">disk_type</span> <span class="devsite-syntax-n">boot_disk</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">initialize_params</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">initialize_params</span> <span class="devsite-syntax-c1"># Remember to set auto_delete to True if you want the disk to be deleted when you delete</span> <span class="devsite-syntax-c1"># your VM instance.</span> <span class="devsite-syntax-n">boot_disk</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">auto_delete</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">auto_delete</span> <span class="devsite-syntax-n">boot_disk</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">boot</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">boot</span> <span class="devsite-syntax-k">return</span> <span class="devsite-syntax-n">boot_disk</span> <span class="devsite-syntax-k">def</span> <span class="devsite-syntax-nf">wait_for_extended_operation</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">operation</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">ExtendedOperation</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">verbose_name</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-s2">"operation"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">timeout</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">int</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-mi">300</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-o">-</span>&gt; <span class="devsite-syntax-n">Any</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sd">"""</span> <span class="devsite-syntax-sd"> Waits for the extended (long-running) operation to complete.</span> <span class="devsite-syntax-sd"> If the operation is successful, it will return its result.</span> <span class="devsite-syntax-sd"> If the operation ends with an error, an exception will be raised.</span> <span class="devsite-syntax-sd"> If there were any warnings during the execution of the operation</span> <span class="devsite-syntax-sd"> they will be printed to sys.stderr.</span> <span class="devsite-syntax-sd"> Args:</span> <span class="devsite-syntax-sd"> operation: a long-running operation you want to wait on.</span> <span class="devsite-syntax-sd"> verbose_name: (optional) a more verbose name of the operation,</span> <span class="devsite-syntax-sd"> used only during error and warning reporting.</span> <span class="devsite-syntax-sd"> timeout: how long (in seconds) to wait for operation to finish.</span> <span class="devsite-syntax-sd"> If None, wait indefinitely.</span> <span class="devsite-syntax-sd"> Returns:</span> <span class="devsite-syntax-sd"> Whatever the operation.result() returns.</span> <span class="devsite-syntax-sd"> Raises:</span> <span class="devsite-syntax-sd"> This method will raise the exception received from `operation.exception()`</span> <span class="devsite-syntax-sd"> or RuntimeError if there is no exception set, but there is an `error_code`</span> <span class="devsite-syntax-sd"> set for the `operation`.</span> <span class="devsite-syntax-sd"> In case of an operation taking longer than `timeout` seconds to complete,</span> <span class="devsite-syntax-sd"> a `concurrent.futures.TimeoutError` will be raised.</span> <span class="devsite-syntax-sd"> """</span> <span class="devsite-syntax-n">result</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">operation</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">result</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">timeout</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">timeout</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">operation</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">error_code</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Error during </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">verbose_name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">: [Code: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">operation</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">error_code</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">]: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">operation</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">error_message</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">file</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">sys</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">stderr</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">flush</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-kc">True</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Operation ID: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">operation</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">file</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">sys</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">stderr</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">flush</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-kc">True</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">raise</span> <span class="devsite-syntax-n">operation</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">exception</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-ow">or</span> <span class="devsite-syntax-ne">RuntimeError</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">operation</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">error_message</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">operation</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">warnings</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Warnings during </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">verbose_name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">:</span><span class="devsite-syntax-se">\n</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">file</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">sys</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">stderr</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">flush</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-kc">True</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">for</span> <span class="devsite-syntax-n">warning</span> <span class="devsite-syntax-ow">in</span> <span class="devsite-syntax-n">operation</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">warnings</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">" - </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">warning</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">code</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">warning</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">message</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">file</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">sys</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">stderr</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">flush</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-kc">True</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">return</span> <span class="devsite-syntax-n">result</span> <span class="devsite-syntax-k">def</span> <span class="devsite-syntax-nf">create_instance</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">project_id</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">instance_name</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">disks</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">list</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">AttachedDisk</span><span class="devsite-syntax-p">],</span> <span class="devsite-syntax-n">machine_type</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-s2">"n1-standard-1"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">network_link</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-s2">"global/networks/default"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">subnetwork_link</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-kc">None</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">internal_ip</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-kc">None</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">external_access</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">bool</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-kc">False</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">external_ipv4</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-kc">None</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">accelerators</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">list</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">AcceleratorConfig</span><span class="devsite-syntax-p">]</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-kc">None</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">preemptible</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">bool</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-kc">False</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">spot</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">bool</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-kc">False</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">instance_termination_action</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-s2">"STOP"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">custom_hostname</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-kc">None</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">delete_protection</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">bool</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-kc">False</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-o">-</span>&gt; <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">Instance</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sd">"""</span> <span class="devsite-syntax-sd"> Send an instance creation request to the Compute Engine API and wait for it to complete.</span> <span class="devsite-syntax-sd"> Args:</span> <span class="devsite-syntax-sd"> project_id: project ID or project number of the Cloud project you want to use.</span> <span class="devsite-syntax-sd"> zone: name of the zone to create the instance in. For example: "us-west3-b"</span> <span class="devsite-syntax-sd"> instance_name: name of the new virtual machine (VM) instance.</span> <span class="devsite-syntax-sd"> disks: a list of compute_v1.AttachedDisk objects describing the disks</span> <span class="devsite-syntax-sd"> you want to attach to your new instance.</span> <span class="devsite-syntax-sd"> machine_type: machine type of the VM being created. This value uses the</span> <span class="devsite-syntax-sd"> following format: "zones/{zone}/machineTypes/{type_name}".</span> <span class="devsite-syntax-sd"> For example: "zones/europe-west3-c/machineTypes/f1-micro"</span> <span class="devsite-syntax-sd"> network_link: name of the network you want the new instance to use.</span> <span class="devsite-syntax-sd"> For example: "global/networks/default" represents the network</span> <span class="devsite-syntax-sd"> named "default", which is created automatically for each project.</span> <span class="devsite-syntax-sd"> subnetwork_link: name of the subnetwork you want the new instance to use.</span> <span class="devsite-syntax-sd"> This value uses the following format:</span> <span class="devsite-syntax-sd"> "regions/{region}/subnetworks/{subnetwork_name}"</span> <span class="devsite-syntax-sd"> internal_ip: internal IP address you want to assign to the new instance.</span> <span class="devsite-syntax-sd"> By default, a free address from the pool of available internal IP addresses of</span> <span class="devsite-syntax-sd"> used subnet will be used.</span> <span class="devsite-syntax-sd"> external_access: boolean flag indicating if the instance should have an external IPv4</span> <span class="devsite-syntax-sd"> address assigned.</span> <span class="devsite-syntax-sd"> external_ipv4: external IPv4 address to be assigned to this instance. If you specify</span> <span class="devsite-syntax-sd"> an external IP address, it must live in the same region as the zone of the instance.</span> <span class="devsite-syntax-sd"> This setting requires `external_access` to be set to True to work.</span> <span class="devsite-syntax-sd"> accelerators: a list of AcceleratorConfig objects describing the accelerators that will</span> <span class="devsite-syntax-sd"> be attached to the new instance.</span> <span class="devsite-syntax-sd"> preemptible: boolean value indicating if the new instance should be preemptible</span> <span class="devsite-syntax-sd"> or not. Preemptible VMs have been deprecated and you should now use Spot VMs.</span> <span class="devsite-syntax-sd"> spot: boolean value indicating if the new instance should be a Spot VM or not.</span> <span class="devsite-syntax-sd"> instance_termination_action: What action should be taken once a Spot VM is terminated.</span> <span class="devsite-syntax-sd"> Possible values: "STOP", "DELETE"</span> <span class="devsite-syntax-sd"> custom_hostname: Custom hostname of the new VM instance.</span> <span class="devsite-syntax-sd"> Custom hostnames must conform to RFC 1035 requirements for valid hostnames.</span> <span class="devsite-syntax-sd"> delete_protection: boolean value indicating if the new virtual machine should be</span> <span class="devsite-syntax-sd"> protected against deletion or not.</span> <span class="devsite-syntax-sd"> Returns:</span> <span class="devsite-syntax-sd"> Instance object.</span> <span class="devsite-syntax-sd"> """</span> <span class="devsite-syntax-n">instance_client</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">InstancesClient</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-c1"># Use the network interface provided in the network_link argument.</span> <span class="devsite-syntax-n">network_interface</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">NetworkInterface</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-n">network_interface</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">network</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">network_link</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">subnetwork_link</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">network_interface</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">subnetwork</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">subnetwork_link</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">internal_ip</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">network_interface</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">network_i_p</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">internal_ip</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">external_access</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">access</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">AccessConfig</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-n">access</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">type_</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">AccessConfig</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">Type</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">ONE_TO_ONE_NAT</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span> <span class="devsite-syntax-n">access</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-s2">"External NAT"</span> <span class="devsite-syntax-n">access</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">network_tier</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">access</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">NetworkTier</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">PREMIUM</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">external_ipv4</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">access</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">nat_i_p</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">external_ipv4</span> <span class="devsite-syntax-n">network_interface</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">access_configs</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-p">[</span><span class="devsite-syntax-n">access</span><span class="devsite-syntax-p">]</span> <span class="devsite-syntax-c1"># Collect information into the Instance object.</span> <span class="devsite-syntax-n">instance</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">Instance</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">network_interfaces</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-p">[</span><span class="devsite-syntax-n">network_interface</span><span class="devsite-syntax-p">]</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">instance_name</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">disks</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">disks</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">re</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">match</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">r</span><span class="devsite-syntax-s2">"^zones/[a-z\d\-]+/machineTypes/[a-z\d\-]+$"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">machine_type</span><span class="devsite-syntax-p">):</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">machine_type</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">machine_type</span> <span class="devsite-syntax-k">else</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">machine_type</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"zones/</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">/machineTypes/</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">machine_type</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">scheduling</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">Scheduling</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">accelerators</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">guest_accelerators</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">accelerators</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">scheduling</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">on_host_maintenance</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">Scheduling</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">OnHostMaintenance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">TERMINATE</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">preemptible</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-c1"># Set the preemptible setting</span> <span class="devsite-syntax-n">warnings</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">warn</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-s2">"Preemptible VMs are being replaced by Spot VMs."</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-ne">DeprecationWarning</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">scheduling</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">Scheduling</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">scheduling</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">preemptible</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-kc">True</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">spot</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-c1"># Set the Spot VM setting</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">scheduling</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">provisioning_model</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">Scheduling</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">ProvisioningModel</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">SPOT</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">scheduling</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">instance_termination_action</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">instance_termination_action</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">custom_hostname</span> <span class="devsite-syntax-ow">is</span> <span class="devsite-syntax-ow">not</span> <span class="devsite-syntax-kc">None</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-c1"># Set the custom hostname for the instance</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">hostname</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">custom_hostname</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">delete_protection</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-c1"># Set the delete protection bit</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">deletion_protection</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-kc">True</span> <span class="devsite-syntax-c1"># Prepare the request to insert an instance.</span> <span class="devsite-syntax-n">request</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">InsertInstanceRequest</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-n">request</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">zone</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">zone</span> <span class="devsite-syntax-n">request</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">project</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">project_id</span> <span class="devsite-syntax-n">request</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">instance_resource</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">instance</span> <span class="devsite-syntax-c1"># Wait for the create operation to complete.</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Creating the </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">instance_name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2"> instance in </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">..."</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-n">operation</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">instance_client</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">insert</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">request</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">request</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-n">wait_for_extended_operation</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">operation</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"instance creation"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Instance </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">instance_name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2"> created."</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">return</span> <span class="devsite-syntax-n">instance_client</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">get</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">project</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">project_id</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">zone</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">instance_name</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">def</span> <span class="devsite-syntax-nf">create_custom_instance</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">project_id</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">instance_name</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">cpu_series</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">CustomMachineType</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">CPUSeries</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">core_count</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">int</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">memory</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">int</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-o">-</span>&gt; <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">Instance</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sd">"""</span> <span class="devsite-syntax-sd"> Create a new VM instance with a custom machine type.</span> <span class="devsite-syntax-sd"> Args:</span> <span class="devsite-syntax-sd"> project_id: project ID or project number of the Cloud project you want to use.</span> <span class="devsite-syntax-sd"> zone: name of the zone to create the instance in. For example: "us-west3-b"</span> <span class="devsite-syntax-sd"> instance_name: name of the new virtual machine (VM) instance.</span> <span class="devsite-syntax-sd"> cpu_series: the type of CPU you want to use. Select one value from the CustomMachineType.CPUSeries enum.</span> <span class="devsite-syntax-sd"> For example: CustomMachineType.CPUSeries.N2</span> <span class="devsite-syntax-sd"> core_count: number of CPU cores you want to use.</span> <span class="devsite-syntax-sd"> memory: the amount of memory for the VM instance, in megabytes.</span> <span class="devsite-syntax-sd"> Return:</span> <span class="devsite-syntax-sd"> Instance object.</span> <span class="devsite-syntax-sd"> """</span> <span class="devsite-syntax-k">assert</span> <span class="devsite-syntax-n">cpu_series</span> <span class="devsite-syntax-ow">in</span> <span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">CustomMachineType</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">CPUSeries</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">E2</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">CustomMachineType</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">CPUSeries</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">N1</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">CustomMachineType</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">CPUSeries</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">N2</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">CustomMachineType</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">CPUSeries</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">N2D</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-n">custom_type</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">CustomMachineType</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">cpu_series</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">memory</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">core_count</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-n">newest_debian</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">get_image_from_family</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">project</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-s2">"debian-cloud"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">family</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-s2">"debian-12"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-n">disk_type</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"zones/</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">/diskTypes/pd-standard"</span> <span class="devsite-syntax-n">disks</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-p">[</span><span class="devsite-syntax-n">disk_from_image</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">disk_type</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-mi">10</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-kc">True</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">newest_debian</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">self_link</span><span class="devsite-syntax-p">)]</span> <span class="devsite-syntax-k">return</span> <span class="devsite-syntax-n">create_instance</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">project_id</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">instance_name</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">disks</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">custom_type</span><span class="devsite-syntax-p">))</span> </code></pre></devsite-code> </div> </section> </section> <section><h3 id="rest" data-text=" REST " tabindex="-1"> REST </h3><p>Using the <a href="/compute/docs/reference/latest/instances/insert"><code translate="no" dir="ltr">instances.insert</code> method</a>, construct an instance creation request and specify the custom <a href="/compute/docs/reference/latest/instances#machineType"><code translate="no" dir="ltr">machineType</code> values</a>. Provide the memory <strong>in MB</strong>.</p> <ul> <li>For N1 machine series, start with custom.</li> <li>For E2-shared core, the NUMBER_OF_CPUs is <code translate="no" dir="ltr">micro</code>, <code translate="no" dir="ltr">small</code>, or <code translate="no" dir="ltr">medium</code>.</li> <li>To enable extended memory, include <code translate="no" dir="ltr">-ext</code> at the end of the machine type.</li> </ul> <p>POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances</p> <p>Example request body</p> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded><code translate="no" dir="ltr"> { &#34;name&#34;: &#34;exampleinstance&#34;, &#34;machineType&#34;: &#34;zones/us-central1-a/machineTypes/n2-custom-16-107520&#34;, &#34;disks&#34;: [ { &#34;boot&#34;: true, &#34;diskSizeGb&#34;: 10, &#34;initializeParams&#34;: { &#34;sourceImage&#34;: &#34;projects/debian-cloud/global/images/family/debian-11&#34; } } ], &#34;networkInterfaces&#34;: [ { &#34;network&#34;: &#34;global/networks/default&#34; } ] } ``` </code></pre></devsite-code></section> </div> <p>You can similarly create <a href="/compute/docs/instances/preemptible">preemptible instances</a> and <a href="/compute/docs/instance-groups">groups of instances</a> with custom machine types.</p> <h3 id="add_extended_memory_during_instance_creation" data-text="Add extended memory during instance creation" tabindex="-1">Add extended memory during instance creation</h3> To create a VM instance with extended memory, do the following:</p> <div class="ds-selector-tabs" data-ds-scope="code-sample"> <section><h3 id="console_1" data-text=" Console " tabindex="-1"> Console </h3><ol> <li><p>In the Google Cloud console, go to the <strong>Create an instance</strong> page.</p> <p><a href="https://console.cloud.google.com/compute/instancesAdd" target="console" track-type="tasks" track-name="consoleLink" track-metadata-position="body" track-metadata-end-goal="createInstanceExtendedMemory" class="button button-primary">Go to Create an instance</a> </p></li> <li><p>In the <strong>Zone</strong> list, select the zone where you want to host this VM. The <strong>Series</strong> list is filtered to include only the machine type families available in the selected zone.</p></li> <li><p>In the <strong>Machine configuration</strong> section, select <strong>General-purpose</strong>.</p> <ol> <li>In the <strong>Series</strong> list, select <strong>N4</strong>, <strong>N2</strong>, <strong>N2D</strong>, <strong>E2</strong>, or <strong>N1</strong> to create a custom machine type.</li> <li>To specify the number of vCPUs drag the <strong>Cores</strong> slider or enter the value in the field. For E2 shared-core, check the box.</li> <li>To add extended memory, select <strong>Extend memory</strong>. To specify the amount of memory for the machine type, drag the <strong>Memory</strong> slider or enter the value in the field. The console displays an estimated cost for the VM as you edit the amount of vCPUs and memory.</li> </ol></li> <li><p>Continue creating the VM.</p></li> </ol></section> <section><h3 id="gcloud_1" data-text=" gcloud " tabindex="-1"> gcloud </h3><p>Create a custom machine using the <a href="/sdk/gcloud/reference/compute/instances/create"><code translate="no" dir="ltr">gcloud compute instances create</code></a> command with the <code translate="no" dir="ltr">--machine-type</code> option.</p> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded><code translate="no" dir="ltr"> gcloud compute instances create <var translate="no">INSTANCE_NAME</var>\ --machine-type=<var translate="no">MACHINE_TYPE</var>-<var translate="no">NUMBER_OF_VCPUS</var>-<var translate="no">AMOUNT_OF_MEMORY_MB</var> </code></pre></devsite-code> <p>Replace the following:</p> <ul> <li><var translate="no">INSTANCE_NAME</var>: name of instance</li> <li><var translate="no">MACHINE_TYPE</var>: machine type, like N2</li> <li><var translate="no">NUMBER_OF_VCPUS</var>: number of vCPUs</li> <li><var translate="no">AMOUNT_OF_MEMORY_MB</var>: amount of memory in MB or GB</li> </ul> <p>Here&#39;s an example using an N2 machine type with 48 vCPUs and 310 GB of memory in zone <code translate="no" dir="ltr">us-central1-a</code>:</p> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded><code translate="no" dir="ltr"> gcloud compute instances create example-instance \ --zone=us-central1-a --machine-type=n2-custom-48-317440 </code></pre></devsite-code> <p>For custom E2 shared-core machine types, use the <code translate="no" dir="ltr">--machine-type</code> option, and indicate the machine type: <code translate="no" dir="ltr">micro</code>, <code translate="no" dir="ltr">small</code>, or <code translate="no" dir="ltr">medium</code> and enter the amount of memory as MB or GB.</p></section> <section><h3 id="go_1" data-text=" Go " tabindex="-1"> Go </h3> <section> <p> Before trying this sample, follow the <span class="notranslate">Go</span> setup instructions in the <a href="/compute/docs/api/using-libraries" track-type="clientLibrariesQuickstart" track-name="go" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/golang-samples/blob//compute/instances/custom-machine-type/extra_mem_without_helper.go" track-metadata-position="compute_custom_machine_type_extra_mem_no_helper">Compute Engine quickstart using client libraries</a>. For more information, see the <a href="/go/docs/reference/cloud.google.com/go/compute/latest/apiv1" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="go" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/golang-samples/blob//compute/instances/custom-machine-type/extra_mem_without_helper.go" track-metadata-region-tag="compute_custom_machine_type_extra_mem_no_helper">Compute Engine <span class="notranslate">Go</span> API reference documentation</a>. </p> <p> To authenticate to Compute Engine, set up Application Default Credentials. For more information, see <a href="/docs/authentication/provide-credentials-adc#local-dev">Set up authentication for a local development environment</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="GoogleCloudPlatform/golang-samples/compute/instances/custom-machine-type/extra_mem_without_helper.go/HEAD/compute_custom_machine_type_extra_mem_no_helper" data-code-snippet="true" data-github-includecode-link="https://github.com/GoogleCloudPlatform/golang-samples/blob/HEAD/compute/instances/custom-machine-type/extra_mem_without_helper.go" feedback-context="{&#34;language&#34;: &#34;go&#34;, &#34;region_tag&#34;: &#34;compute_custom_machine_type_extra_mem_no_helper&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/GoogleCloudPlatform/golang-samples/blob/HEAD/compute/instances/custom-machine-type/extra_mem_without_helper.go&#34;}" feedback-product="1634365" feedback-bucket="infraops" language="go" data-github-path="GoogleCloudPlatform/golang-samples/compute/instances/custom-machine-type/extra_mem_without_helper.go" data-git-revision="HEAD" data-region-tag="compute_custom_machine_type_extra_mem_no_helper" dir="ltr" is-upgraded syntax="Go"><code translate="no" dir="ltr"><span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"context"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"fmt"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"io"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">compute</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"cloud.google.com/go/compute/apiv1"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">computepb</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"cloud.google.com/go/compute/apiv1/computepb"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"google.golang.org/protobuf/proto"</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1">// createInstanceWithExtraMemWithoutHelper сreates new VM instances with extra memory</span> <span class="devsite-syntax-c1">// without using a CustomMachineType struct.</span> <span class="devsite-syntax-kd">func</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">createInstanceWithExtraMemWithoutHelper</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">w</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">io</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Writer</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">projectID</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instanceName</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">coreCount</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">memory</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">error</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// projectID := "your_project_id"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// zone := "europe-central2-b"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// instanceName := "your_instance_name"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// cpuSeries := "N1"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// coreCount := 2 // number of CPU cores you want to use.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// memory := 256 // the amount of memory for the VM instance, in megabytes.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// The coreCount and memory values are not validated anywhere and can be rejected by the API.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">ctx</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">context</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Background</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instancesClient</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">compute</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">NewInstancesRESTClient</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">ctx</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Errorf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"NewInstancesRESTClient: %w"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">defer</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instancesClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Close</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">mt</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Sprintf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"zones/%s/machineTypes/%v-%v-%v-ext"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">coreCount</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">memory</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">inst</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span>&amp;<span class="devsite-syntax-nx">computepb</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Instance</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Name</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">proto</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">String</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">instanceName</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Disks</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[]</span><span class="devsite-syntax-o">*</span><span class="devsite-syntax-nx">computepb</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">AttachedDisk</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">InitializeParams</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span>&amp;<span class="devsite-syntax-nx">computepb</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">AttachedDiskInitializeParams</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">DiskSizeGb</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">proto</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Int64</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">10</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">SourceImage</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">proto</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">String</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"projects/debian-cloud/global/images/family/debian-12"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">AutoDelete</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">proto</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Bool</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-kc">true</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Boot</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">proto</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Bool</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-kc">true</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">MachineType</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">proto</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">String</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">mt</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">NetworkInterfaces</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[]</span><span class="devsite-syntax-o">*</span><span class="devsite-syntax-nx">computepb</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">NetworkInterface</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Name</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">proto</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">String</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"global/networks/default"</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">req</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span>&amp;<span class="devsite-syntax-nx">computepb</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">InsertInstanceRequest</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Project</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">projectID</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Zone</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">InstanceResource</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">inst</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">op</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instancesClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Insert</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">ctx</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">req</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Errorf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"unable to create instance: %w"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">op</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Wait</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">ctx</span><span class="devsite-syntax-p">);</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Errorf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"unable to wait for the operation: %w"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Fprintf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">w</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"Instance created\n"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span> <span class="devsite-syntax-p">}</span> </code></pre></devsite-code> </div> </section> </section> <section><h3 id="java_1" data-text=" Java " tabindex="-1"> Java </h3> <section> <p> Before trying this sample, follow the <span class="notranslate">Java</span> setup instructions in the <a href="/compute/docs/api/using-libraries" track-type="clientLibrariesQuickstart" track-name="java" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/java-docs-samples/blob//compute/cloud-client/src/main/java/compute/custommachinetype/ExtraMemoryWithoutHelper.java" track-metadata-position="compute_custom_machine_type_extra_mem_no_helper">Compute Engine quickstart using client libraries</a>. For more information, see the <a href="/java/docs/reference/google-cloud-compute/latest/overview" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="java" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/java-docs-samples/blob//compute/cloud-client/src/main/java/compute/custommachinetype/ExtraMemoryWithoutHelper.java" track-metadata-region-tag="compute_custom_machine_type_extra_mem_no_helper">Compute Engine <span class="notranslate">Java</span> API reference documentation</a>. </p> <p> To authenticate to Compute Engine, set up Application Default Credentials. For more information, see <a href="/docs/authentication/provide-credentials-adc#local-dev">Set up authentication for a local development environment</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="GoogleCloudPlatform/java-docs-samples/compute/cloud-client/src/main/java/compute/custommachinetype/ExtraMemoryWithoutHelper.java/HEAD/compute_custom_machine_type_extra_mem_no_helper" data-code-snippet="true" data-github-includecode-link="https://github.com/GoogleCloudPlatform/java-docs-samples/blob/HEAD/compute/cloud-client/src/main/java/compute/custommachinetype/ExtraMemoryWithoutHelper.java" feedback-context="{&#34;language&#34;: &#34;java&#34;, &#34;region_tag&#34;: &#34;compute_custom_machine_type_extra_mem_no_helper&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/GoogleCloudPlatform/java-docs-samples/blob/HEAD/compute/cloud-client/src/main/java/compute/custommachinetype/ExtraMemoryWithoutHelper.java&#34;}" feedback-product="1634365" feedback-bucket="infraops" language="java" data-github-path="GoogleCloudPlatform/java-docs-samples/compute/cloud-client/src/main/java/compute/custommachinetype/ExtraMemoryWithoutHelper.java" data-git-revision="HEAD" data-region-tag="compute_custom_machine_type_extra_mem_no_helper" dir="ltr" is-upgraded syntax="Java"><code translate="no" dir="ltr"> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.compute.v1.AttachedDisk</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.compute.v1.AttachedDiskInitializeParams</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.compute.v1.InsertInstanceRequest</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.compute.v1.Instance</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.compute.v1.InstancesClient</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.compute.v1.NetworkInterface</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.compute.v1.Operation</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">java.io.IOException</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">java.util.concurrent.ExecutionException</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">java.util.concurrent.TimeUnit</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">java.util.concurrent.TimeoutException</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kd">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">class</span> <span class="devsite-syntax-nc">ExtraMemoryWithoutHelper</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">static</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">void</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nf">main</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-o">[]</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">args</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">throws</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">IOException</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">ExecutionException</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">InterruptedException</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">TimeoutException</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// TODO(developer): Replace these variables before running the sample.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Project ID or project number of the Cloud project you want to use.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">projectId</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"your-google-cloud-project-id"</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Name of the zone to create the instance in. For example: "us-west3-b".</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"google-cloud-zone"</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Name of the new virtual machine (VM) instance.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">instanceName</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"instance-name"</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">cpuSeries</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"N1"</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Number of CPU cores you want to use.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">coreCount</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">2</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// The amount of memory for the VM instance, in megabytes.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">memory</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">256</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">createInstanceWithExtraMemoryWithoutHelper</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">projectId</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">instanceName</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">cpuSeries</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">coreCount</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">memory</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Create VM instances with extra memory without using a CustomMachineType class and</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// return the created Instance.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">static</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">void</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nf">createInstanceWithExtraMemoryWithoutHelper</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">project</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">instanceName</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">cpuSeries</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">coreCount</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">memory</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">throws</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">IOException</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">ExecutionException</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">InterruptedException</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">TimeoutException</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Initialize client that will be used to send requests. This client only needs to be created</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// once, and can be reused for multiple requests. After completing all of your requests, call</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// the `instancesClient.close()` method on the client to safely</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// clean up any remaining background resources.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">try</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">InstancesClient</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">instancesClient</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">InstancesClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">create</span><span class="devsite-syntax-p">())</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// The coreCount and memory values are not validated anywhere and can be rejected by the API.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">machineType</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">format</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"zones/%s/machineTypes/%s-%s-%s-ext"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">cpuSeries</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">coreCount</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">memory</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">AttachedDisk</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">attachedDisk</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">AttachedDisk</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">newBuilder</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setInitializeParams</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Describe the size and source image of the boot disk to attach to the instance.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// The list of public images available in Compute Engine can be found here:</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// https://cloud.google.com/compute/docs/images#list_of_public_images_available_on</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">AttachedDiskInitializeParams</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">newBuilder</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setSourceImage</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">format</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"projects/%s/global/images/family/%s"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"debian-cloud"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"debian-11"</span><span class="devsite-syntax-p">))</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setDiskSizeGb</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">10</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">build</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Remember to set auto_delete to True if you want the disk to be deleted when you delete</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// your VM instance.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setAutoDelete</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-kc">true</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setBoot</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-kc">true</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">build</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Create the Instance object with the relevant information.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Instance</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">instance</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Instance</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">newBuilder</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setName</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">instanceName</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">addDisks</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">attachedDisk</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setMachineType</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">machineType</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">addNetworkInterfaces</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">NetworkInterface</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">newBuilder</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-na">setName</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"global/networks/default"</span><span class="devsite-syntax-p">).</span><span class="devsite-syntax-na">build</span><span class="devsite-syntax-p">())</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">build</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Create the insert instance request object.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">InsertInstanceRequest</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">insertInstanceRequest</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">InsertInstanceRequest</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">newBuilder</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setProject</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">project</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setZone</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setInstanceResource</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">instance</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">build</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Invoke the API with the request object and wait for the operation to complete.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Operation</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">response</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">instancesClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">insertAsync</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">insertInstanceRequest</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">get</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">3</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">TimeUnit</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">MINUTES</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Check for errors.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">response</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">hasError</span><span class="devsite-syntax-p">())</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Instance creation failed!!"</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">response</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">printf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Instance created : %s"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">instanceName</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Operation Status: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">response</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getStatus</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-p">}</span></code></pre></devsite-code> </div> </section> </section> <section><h3 id="node.js_1" data-text=" Node.js " tabindex="-1"> Node.js </h3> <section> <p> Before trying this sample, follow the <span class="notranslate">Node.js</span> setup instructions in the <a href="/compute/docs/api/using-libraries" track-type="clientLibrariesQuickstart" track-name="nodejs" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob//compute/instances/custom-machine-type/extraMemWithoutHelper.js" track-metadata-position="compute_custom_machine_type_extra_mem_no_helper">Compute Engine quickstart using client libraries</a>. For more information, see the <a href="/nodejs/docs/reference/compute/latest" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="nodejs" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob//compute/instances/custom-machine-type/extraMemWithoutHelper.js" track-metadata-region-tag="compute_custom_machine_type_extra_mem_no_helper">Compute Engine <span class="notranslate">Node.js</span> API reference documentation</a>. </p> <p> To authenticate to Compute Engine, set up Application Default Credentials. For more information, see <a href="/docs/authentication/provide-credentials-adc#local-dev">Set up authentication for a local development environment</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="GoogleCloudPlatform/nodejs-docs-samples/compute/instances/custom-machine-type/extraMemWithoutHelper.js/HEAD/compute_custom_machine_type_extra_mem_no_helper" data-code-snippet="true" data-github-includecode-link="https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/HEAD/compute/instances/custom-machine-type/extraMemWithoutHelper.js" feedback-context="{&#34;language&#34;: &#34;nodejs&#34;, &#34;region_tag&#34;: &#34;compute_custom_machine_type_extra_mem_no_helper&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/HEAD/compute/instances/custom-machine-type/extraMemWithoutHelper.js&#34;}" feedback-product="1634365" feedback-bucket="infraops" language="nodejs" data-github-path="GoogleCloudPlatform/nodejs-docs-samples/compute/instances/custom-machine-type/extraMemWithoutHelper.js" data-git-revision="HEAD" data-region-tag="compute_custom_machine_type_extra_mem_no_helper" dir="ltr" is-upgraded syntax="JavaScript"><code translate="no" dir="ltr"><span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * TODO(developer): Uncomment and replace these variables before running the sample.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-c1">// const projectId = 'YOUR_PROJECT_ID';</span> <span class="devsite-syntax-c1">// const zone = 'europe-central2-b';</span> <span class="devsite-syntax-c1">// const instanceName = 'YOUR_INSTANCE_NAME';</span> <span class="devsite-syntax-c1">// const cpuSeries = 'N1';</span> <span class="devsite-syntax-c1">// const coreCount = 2</span> <span class="devsite-syntax-c1">// const memory = 256</span> <span class="devsite-syntax-c1">// The coreCount and memory values are not validated anywhere and can be rejected by the API.</span> <span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">compute</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">require</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s1">'@google-cloud/compute'</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-k">async</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">function</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">createInstanceWithExtraMemWithoutHelper</span><span class="devsite-syntax-p">()</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instancesClient</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ow">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">compute</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">InstancesClient</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">machineType</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-sb">`zones/</span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">/machineTypes/</span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">cpuSeries</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">-</span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">coreCount</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">-</span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">memory</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">-ext`</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-nx">response</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">await</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instancesClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">insert</span><span class="devsite-syntax-p">({</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instanceResource</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">name</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instanceName</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">disks</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">initializeParams</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">diskSizeGb</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'64'</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">sourceImage</span><span class="devsite-syntax-o">:</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'projects/debian-cloud/global/images/family/debian-11/'</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">autoDelete</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">true</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">boot</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">true</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">],</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">machineType</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">networkInterfaces</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">name</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'global/networks/default'</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">],</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">project</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">projectId</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">});</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">let</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">operation</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">response</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">latestResponse</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">operationsClient</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ow">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">compute</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">ZoneOperationsClient</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Wait for the create operation to complete.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">while</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">operation</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">status</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!==</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'DONE'</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-nx">operation</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">await</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">operationsClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">wait</span><span class="devsite-syntax-p">({</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">operation</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">operation</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">name</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">project</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">projectId</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">operation</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">split</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s1">'/'</span><span class="devsite-syntax-p">).</span><span class="devsite-syntax-nx">pop</span><span class="devsite-syntax-p">(),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">});</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s1">'Instance created.'</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-p">}</span> <span class="devsite-syntax-nx">createInstanceWithExtraMemWithoutHelper</span><span class="devsite-syntax-p">();</span></code></pre></devsite-code> </div> </section> </section> <section><h3 id="python_1" data-text=" Python " tabindex="-1"> Python </h3> <section> <p> Before trying this sample, follow the <span class="notranslate">Python</span> setup instructions in the <a href="/compute/docs/api/using-libraries" track-type="clientLibrariesQuickstart" track-name="python" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/python-docs-samples/blob//compute/client_library/snippets/instances/custom_machine_types/extra_mem_no_helper.py" track-metadata-position="compute_custom_machine_type_extra_mem_no_helper">Compute Engine quickstart using client libraries</a>. For more information, see the <a href="/python/docs/reference/compute/latest" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="python" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/python-docs-samples/blob//compute/client_library/snippets/instances/custom_machine_types/extra_mem_no_helper.py" track-metadata-region-tag="compute_custom_machine_type_extra_mem_no_helper">Compute Engine <span class="notranslate">Python</span> API reference documentation</a>. </p> <p> To authenticate to Compute Engine, set up Application Default Credentials. For more information, see <a href="/docs/authentication/provide-credentials-adc#local-dev">Set up authentication for a local development environment</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="GoogleCloudPlatform/python-docs-samples/compute/client_library/snippets/instances/custom_machine_types/extra_mem_no_helper.py/HEAD/compute_custom_machine_type_extra_mem_no_helper" data-code-snippet="true" data-github-includecode-link="https://github.com/GoogleCloudPlatform/python-docs-samples/blob/HEAD/compute/client_library/snippets/instances/custom_machine_types/extra_mem_no_helper.py" feedback-context="{&#34;language&#34;: &#34;python&#34;, &#34;region_tag&#34;: &#34;compute_custom_machine_type_extra_mem_no_helper&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/GoogleCloudPlatform/python-docs-samples/blob/HEAD/compute/client_library/snippets/instances/custom_machine_types/extra_mem_no_helper.py&#34;}" feedback-product="1634365" feedback-bucket="infraops" language="python" data-github-path="GoogleCloudPlatform/python-docs-samples/compute/client_library/snippets/instances/custom_machine_types/extra_mem_no_helper.py" data-git-revision="HEAD" data-region-tag="compute_custom_machine_type_extra_mem_no_helper" dir="ltr" is-upgraded syntax="Python"><code translate="no" dir="ltr"><span class="devsite-syntax-kn">from</span> <span class="devsite-syntax-nn">__future__</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-n">annotations</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-nn">re</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-nn">sys</span> <span class="devsite-syntax-kn">from</span> <span class="devsite-syntax-nn">typing</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-n">Any</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-nn">warnings</span> <span class="devsite-syntax-kn">from</span> <span class="devsite-syntax-nn">google.api_core.extended_operation</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-n">ExtendedOperation</span> <span class="devsite-syntax-kn">from</span> <span class="devsite-syntax-nn">google.cloud</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-n">compute_v1</span> <span class="devsite-syntax-k">def</span> <span class="devsite-syntax-nf">get_image_from_family</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">project</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">family</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-o">-</span>&gt; <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">Image</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sd">"""</span> <span class="devsite-syntax-sd"> Retrieve the newest image that is part of a given family in a project.</span> <span class="devsite-syntax-sd"> Args:</span> <span class="devsite-syntax-sd"> project: project ID or project number of the Cloud project you want to get image from.</span> <span class="devsite-syntax-sd"> family: name of the image family you want to get image from.</span> <span class="devsite-syntax-sd"> Returns:</span> <span class="devsite-syntax-sd"> An Image object.</span> <span class="devsite-syntax-sd"> """</span> <span class="devsite-syntax-n">image_client</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">ImagesClient</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-c1"># List of public operating system (OS) images: https://cloud.google.com/compute/docs/images/os-details</span> <span class="devsite-syntax-n">newest_image</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">image_client</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">get_from_family</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">project</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">project</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">family</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">family</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">return</span> <span class="devsite-syntax-n">newest_image</span> <span class="devsite-syntax-k">def</span> <span class="devsite-syntax-nf">disk_from_image</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">disk_type</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">disk_size_gb</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">int</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">boot</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">bool</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">source_image</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">auto_delete</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">bool</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-kc">True</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-o">-</span>&gt; <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">AttachedDisk</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sd">"""</span> <span class="devsite-syntax-sd"> Create an AttachedDisk object to be used in VM instance creation. Uses an image as the</span> <span class="devsite-syntax-sd"> source for the new disk.</span> <span class="devsite-syntax-sd"> Args:</span> <span class="devsite-syntax-sd"> disk_type: the type of disk you want to create. This value uses the following format:</span> <span class="devsite-syntax-sd"> "zones/{zone}/diskTypes/(pd-standard|pd-ssd|pd-balanced|pd-extreme)".</span> <span class="devsite-syntax-sd"> For example: "zones/us-west3-b/diskTypes/pd-ssd"</span> <span class="devsite-syntax-sd"> disk_size_gb: size of the new disk in gigabytes</span> <span class="devsite-syntax-sd"> boot: boolean flag indicating whether this disk should be used as a boot disk of an instance</span> <span class="devsite-syntax-sd"> source_image: source image to use when creating this disk. You must have read access to this disk. This can be one</span> <span class="devsite-syntax-sd"> of the publicly available images or an image from one of your projects.</span> <span class="devsite-syntax-sd"> This value uses the following format: "projects/{project_name}/global/images/{image_name}"</span> <span class="devsite-syntax-sd"> auto_delete: boolean flag indicating whether this disk should be deleted with the VM that uses it</span> <span class="devsite-syntax-sd"> Returns:</span> <span class="devsite-syntax-sd"> AttachedDisk object configured to be created using the specified image.</span> <span class="devsite-syntax-sd"> """</span> <span class="devsite-syntax-n">boot_disk</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">AttachedDisk</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-n">initialize_params</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">AttachedDiskInitializeParams</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-n">initialize_params</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">source_image</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">source_image</span> <span class="devsite-syntax-n">initialize_params</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">disk_size_gb</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">disk_size_gb</span> <span class="devsite-syntax-n">initialize_params</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">disk_type</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">disk_type</span> <span class="devsite-syntax-n">boot_disk</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">initialize_params</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">initialize_params</span> <span class="devsite-syntax-c1"># Remember to set auto_delete to True if you want the disk to be deleted when you delete</span> <span class="devsite-syntax-c1"># your VM instance.</span> <span class="devsite-syntax-n">boot_disk</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">auto_delete</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">auto_delete</span> <span class="devsite-syntax-n">boot_disk</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">boot</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">boot</span> <span class="devsite-syntax-k">return</span> <span class="devsite-syntax-n">boot_disk</span> <span class="devsite-syntax-k">def</span> <span class="devsite-syntax-nf">wait_for_extended_operation</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">operation</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">ExtendedOperation</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">verbose_name</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-s2">"operation"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">timeout</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">int</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-mi">300</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-o">-</span>&gt; <span class="devsite-syntax-n">Any</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sd">"""</span> <span class="devsite-syntax-sd"> Waits for the extended (long-running) operation to complete.</span> <span class="devsite-syntax-sd"> If the operation is successful, it will return its result.</span> <span class="devsite-syntax-sd"> If the operation ends with an error, an exception will be raised.</span> <span class="devsite-syntax-sd"> If there were any warnings during the execution of the operation</span> <span class="devsite-syntax-sd"> they will be printed to sys.stderr.</span> <span class="devsite-syntax-sd"> Args:</span> <span class="devsite-syntax-sd"> operation: a long-running operation you want to wait on.</span> <span class="devsite-syntax-sd"> verbose_name: (optional) a more verbose name of the operation,</span> <span class="devsite-syntax-sd"> used only during error and warning reporting.</span> <span class="devsite-syntax-sd"> timeout: how long (in seconds) to wait for operation to finish.</span> <span class="devsite-syntax-sd"> If None, wait indefinitely.</span> <span class="devsite-syntax-sd"> Returns:</span> <span class="devsite-syntax-sd"> Whatever the operation.result() returns.</span> <span class="devsite-syntax-sd"> Raises:</span> <span class="devsite-syntax-sd"> This method will raise the exception received from `operation.exception()`</span> <span class="devsite-syntax-sd"> or RuntimeError if there is no exception set, but there is an `error_code`</span> <span class="devsite-syntax-sd"> set for the `operation`.</span> <span class="devsite-syntax-sd"> In case of an operation taking longer than `timeout` seconds to complete,</span> <span class="devsite-syntax-sd"> a `concurrent.futures.TimeoutError` will be raised.</span> <span class="devsite-syntax-sd"> """</span> <span class="devsite-syntax-n">result</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">operation</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">result</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">timeout</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">timeout</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">operation</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">error_code</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Error during </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">verbose_name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">: [Code: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">operation</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">error_code</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">]: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">operation</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">error_message</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">file</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">sys</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">stderr</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">flush</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-kc">True</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Operation ID: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">operation</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">file</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">sys</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">stderr</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">flush</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-kc">True</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">raise</span> <span class="devsite-syntax-n">operation</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">exception</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-ow">or</span> <span class="devsite-syntax-ne">RuntimeError</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">operation</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">error_message</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">operation</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">warnings</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Warnings during </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">verbose_name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">:</span><span class="devsite-syntax-se">\n</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">file</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">sys</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">stderr</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">flush</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-kc">True</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">for</span> <span class="devsite-syntax-n">warning</span> <span class="devsite-syntax-ow">in</span> <span class="devsite-syntax-n">operation</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">warnings</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">" - </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">warning</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">code</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">warning</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">message</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">file</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">sys</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">stderr</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">flush</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-kc">True</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">return</span> <span class="devsite-syntax-n">result</span> <span class="devsite-syntax-k">def</span> <span class="devsite-syntax-nf">create_instance</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">project_id</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">instance_name</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">disks</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">list</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">AttachedDisk</span><span class="devsite-syntax-p">],</span> <span class="devsite-syntax-n">machine_type</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-s2">"n1-standard-1"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">network_link</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-s2">"global/networks/default"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">subnetwork_link</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-kc">None</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">internal_ip</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-kc">None</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">external_access</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">bool</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-kc">False</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">external_ipv4</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-kc">None</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">accelerators</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">list</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">AcceleratorConfig</span><span class="devsite-syntax-p">]</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-kc">None</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">preemptible</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">bool</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-kc">False</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">spot</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">bool</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-kc">False</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">instance_termination_action</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-s2">"STOP"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">custom_hostname</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-kc">None</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">delete_protection</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">bool</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-kc">False</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-o">-</span>&gt; <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">Instance</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sd">"""</span> <span class="devsite-syntax-sd"> Send an instance creation request to the Compute Engine API and wait for it to complete.</span> <span class="devsite-syntax-sd"> Args:</span> <span class="devsite-syntax-sd"> project_id: project ID or project number of the Cloud project you want to use.</span> <span class="devsite-syntax-sd"> zone: name of the zone to create the instance in. For example: "us-west3-b"</span> <span class="devsite-syntax-sd"> instance_name: name of the new virtual machine (VM) instance.</span> <span class="devsite-syntax-sd"> disks: a list of compute_v1.AttachedDisk objects describing the disks</span> <span class="devsite-syntax-sd"> you want to attach to your new instance.</span> <span class="devsite-syntax-sd"> machine_type: machine type of the VM being created. This value uses the</span> <span class="devsite-syntax-sd"> following format: "zones/{zone}/machineTypes/{type_name}".</span> <span class="devsite-syntax-sd"> For example: "zones/europe-west3-c/machineTypes/f1-micro"</span> <span class="devsite-syntax-sd"> network_link: name of the network you want the new instance to use.</span> <span class="devsite-syntax-sd"> For example: "global/networks/default" represents the network</span> <span class="devsite-syntax-sd"> named "default", which is created automatically for each project.</span> <span class="devsite-syntax-sd"> subnetwork_link: name of the subnetwork you want the new instance to use.</span> <span class="devsite-syntax-sd"> This value uses the following format:</span> <span class="devsite-syntax-sd"> "regions/{region}/subnetworks/{subnetwork_name}"</span> <span class="devsite-syntax-sd"> internal_ip: internal IP address you want to assign to the new instance.</span> <span class="devsite-syntax-sd"> By default, a free address from the pool of available internal IP addresses of</span> <span class="devsite-syntax-sd"> used subnet will be used.</span> <span class="devsite-syntax-sd"> external_access: boolean flag indicating if the instance should have an external IPv4</span> <span class="devsite-syntax-sd"> address assigned.</span> <span class="devsite-syntax-sd"> external_ipv4: external IPv4 address to be assigned to this instance. If you specify</span> <span class="devsite-syntax-sd"> an external IP address, it must live in the same region as the zone of the instance.</span> <span class="devsite-syntax-sd"> This setting requires `external_access` to be set to True to work.</span> <span class="devsite-syntax-sd"> accelerators: a list of AcceleratorConfig objects describing the accelerators that will</span> <span class="devsite-syntax-sd"> be attached to the new instance.</span> <span class="devsite-syntax-sd"> preemptible: boolean value indicating if the new instance should be preemptible</span> <span class="devsite-syntax-sd"> or not. Preemptible VMs have been deprecated and you should now use Spot VMs.</span> <span class="devsite-syntax-sd"> spot: boolean value indicating if the new instance should be a Spot VM or not.</span> <span class="devsite-syntax-sd"> instance_termination_action: What action should be taken once a Spot VM is terminated.</span> <span class="devsite-syntax-sd"> Possible values: "STOP", "DELETE"</span> <span class="devsite-syntax-sd"> custom_hostname: Custom hostname of the new VM instance.</span> <span class="devsite-syntax-sd"> Custom hostnames must conform to RFC 1035 requirements for valid hostnames.</span> <span class="devsite-syntax-sd"> delete_protection: boolean value indicating if the new virtual machine should be</span> <span class="devsite-syntax-sd"> protected against deletion or not.</span> <span class="devsite-syntax-sd"> Returns:</span> <span class="devsite-syntax-sd"> Instance object.</span> <span class="devsite-syntax-sd"> """</span> <span class="devsite-syntax-n">instance_client</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">InstancesClient</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-c1"># Use the network interface provided in the network_link argument.</span> <span class="devsite-syntax-n">network_interface</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">NetworkInterface</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-n">network_interface</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">network</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">network_link</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">subnetwork_link</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">network_interface</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">subnetwork</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">subnetwork_link</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">internal_ip</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">network_interface</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">network_i_p</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">internal_ip</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">external_access</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">access</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">AccessConfig</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-n">access</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">type_</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">AccessConfig</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">Type</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">ONE_TO_ONE_NAT</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span> <span class="devsite-syntax-n">access</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-s2">"External NAT"</span> <span class="devsite-syntax-n">access</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">network_tier</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">access</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">NetworkTier</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">PREMIUM</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">external_ipv4</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">access</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">nat_i_p</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">external_ipv4</span> <span class="devsite-syntax-n">network_interface</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">access_configs</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-p">[</span><span class="devsite-syntax-n">access</span><span class="devsite-syntax-p">]</span> <span class="devsite-syntax-c1"># Collect information into the Instance object.</span> <span class="devsite-syntax-n">instance</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">Instance</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">network_interfaces</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-p">[</span><span class="devsite-syntax-n">network_interface</span><span class="devsite-syntax-p">]</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">instance_name</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">disks</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">disks</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">re</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">match</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">r</span><span class="devsite-syntax-s2">"^zones/[a-z\d\-]+/machineTypes/[a-z\d\-]+$"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">machine_type</span><span class="devsite-syntax-p">):</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">machine_type</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">machine_type</span> <span class="devsite-syntax-k">else</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">machine_type</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"zones/</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">/machineTypes/</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">machine_type</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">scheduling</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">Scheduling</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">accelerators</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">guest_accelerators</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">accelerators</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">scheduling</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">on_host_maintenance</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">Scheduling</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">OnHostMaintenance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">TERMINATE</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">preemptible</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-c1"># Set the preemptible setting</span> <span class="devsite-syntax-n">warnings</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">warn</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-s2">"Preemptible VMs are being replaced by Spot VMs."</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-ne">DeprecationWarning</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">scheduling</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">Scheduling</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">scheduling</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">preemptible</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-kc">True</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">spot</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-c1"># Set the Spot VM setting</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">scheduling</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">provisioning_model</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">Scheduling</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">ProvisioningModel</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">SPOT</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">scheduling</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">instance_termination_action</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">instance_termination_action</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">custom_hostname</span> <span class="devsite-syntax-ow">is</span> <span class="devsite-syntax-ow">not</span> <span class="devsite-syntax-kc">None</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-c1"># Set the custom hostname for the instance</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">hostname</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">custom_hostname</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">delete_protection</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-c1"># Set the delete protection bit</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">deletion_protection</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-kc">True</span> <span class="devsite-syntax-c1"># Prepare the request to insert an instance.</span> <span class="devsite-syntax-n">request</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">InsertInstanceRequest</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-n">request</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">zone</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">zone</span> <span class="devsite-syntax-n">request</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">project</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">project_id</span> <span class="devsite-syntax-n">request</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">instance_resource</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">instance</span> <span class="devsite-syntax-c1"># Wait for the create operation to complete.</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Creating the </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">instance_name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2"> instance in </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">..."</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-n">operation</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">instance_client</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">insert</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">request</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">request</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-n">wait_for_extended_operation</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">operation</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"instance creation"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Instance </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">instance_name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2"> created."</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">return</span> <span class="devsite-syntax-n">instance_client</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">get</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">project</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">project_id</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">zone</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">instance_name</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">def</span> <span class="devsite-syntax-nf">create_custom_instances_extra_mem</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">project_id</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">instance_name</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">core_count</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">int</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">memory</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">int</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-o">-</span>&gt; <span class="devsite-syntax-nb">list</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">Instance</span><span class="devsite-syntax-p">]:</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sd">"""</span> <span class="devsite-syntax-sd"> Create 3 new VM instances with extra memory without using a CustomMachineType helper class.</span> <span class="devsite-syntax-sd"> Args:</span> <span class="devsite-syntax-sd"> project_id: project ID or project number of the Cloud project you want to use.</span> <span class="devsite-syntax-sd"> zone: name of the zone to create the instance in. For example: "us-west3-b"</span> <span class="devsite-syntax-sd"> instance_name: name of the new virtual machine (VM) instance.</span> <span class="devsite-syntax-sd"> core_count: number of CPU cores you want to use.</span> <span class="devsite-syntax-sd"> memory: the amount of memory for the VM instance, in megabytes.</span> <span class="devsite-syntax-sd"> Returns:</span> <span class="devsite-syntax-sd"> List of Instance objects.</span> <span class="devsite-syntax-sd"> """</span> <span class="devsite-syntax-n">newest_debian</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">get_image_from_family</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">project</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-s2">"debian-cloud"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">family</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-s2">"debian-12"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-n">disk_type</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"zones/</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">/diskTypes/pd-standard"</span> <span class="devsite-syntax-n">disks</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-p">[</span><span class="devsite-syntax-n">disk_from_image</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">disk_type</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-mi">10</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-kc">True</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">newest_debian</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">self_link</span><span class="devsite-syntax-p">)]</span> <span class="devsite-syntax-c1"># The core_count and memory values are not validated anywhere and can be rejected by the API.</span> <span class="devsite-syntax-n">instances</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-p">[</span> <span class="devsite-syntax-n">create_instance</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">project_id</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">instance_name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">_n1_extra_mem"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">disks</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"zones/</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">/machineTypes/custom-</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">core_count</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">-</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">memory</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">-ext"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">),</span> <span class="devsite-syntax-n">create_instance</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">project_id</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">instance_name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">_n2_extra_mem"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">disks</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"zones/</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">/machineTypes/n2-custom-</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">core_count</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">-</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">memory</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">-ext"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">),</span> <span class="devsite-syntax-n">create_instance</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">project_id</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">instance_name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">_n2d_extra_mem"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">disks</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"zones/</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">/machineTypes/n2d-custom-</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">core_count</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">-</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">memory</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">-ext"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">),</span> <span class="devsite-syntax-p">]</span> <span class="devsite-syntax-k">return</span> <span class="devsite-syntax-n">instances</span> </code></pre></devsite-code> </div> </section> </section> <section><h3 id="rest_1" data-text=" REST " tabindex="-1"> REST </h3><p>Using the <a href="/compute/docs/reference/latest/instances/insert"><code translate="no" dir="ltr">instances.insert</code> method</a>, construct your instance creation request as you would to create an instance with custom memory. Include <code translate="no" dir="ltr">-ext</code>, which indicates extended memory, when specifying the <code translate="no" dir="ltr">machineType</code> values:</p> <ul> <li>For all custom machine types append <code translate="no" dir="ltr">-ext</code> to extend the memory up to the limit as described by that particular machine family.</li> <li>E2 shared-core, specify <code translate="no" dir="ltr">micro</code>, <code translate="no" dir="ltr">small</code>, or <code translate="no" dir="ltr">medium</code>.</li> </ul> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded><code translate="no" dir="ltr"> zones/<var translate="no">ZONE</var>/machineTypes//<var translate="no">MACHINE_TYPE</var>-<var translate="no">NUMBER_OF_CPUS</var>-<var translate="no">AMOUNT_OF_MEMORY</var>-ext </code></pre></devsite-code> <p>Replace the following:</p> <ul> <li><var translate="no">ZONE</var>: Machine location</li> <li><var translate="no">MACHINE_TYPE</var>: Machine type, like N2 or E2 small</li> <li><var translate="no">NUMBER_OF_CPUS</var>: amount of vCPUs</li> <li><var translate="no">AMOUNT_OF_MEMORY_MB</var>: amount of memory in MB</li> </ul> <p>For example, the following specifies an N2 machine type with 2 vCPUs and 20 GB of memory, note that you must convert the memory to MB:</p> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded syntax="reStructuredText"><code translate="no" dir="ltr">zones/<var translate="no">ZONE</var>/machineTypes/n2-custom-2-20480-ext </code></pre></devsite-code></section> </div> <h3 id="add_extended_memory_to_an_existing_vm_instance" data-text="Add extended memory to an existing VM instance" tabindex="-1">Add extended memory to an existing VM instance</h3> To add more memory to an existing instance, you must first <a href="/compute/docs/instances/stop-start-instance">stop the instance</a>. After the instance stops, complete the following steps to add more memory to the VM.</p> <div class="ds-selector-tabs" data-ds-scope="code-sample"> <section><h3 id="console_2" data-text=" Console " tabindex="-1"> Console </h3><ol> <li><p>In the Google Cloud console, go to the <strong>VM instances</strong> page.</p> <p><a href="https://console.cloud.google.com/compute/instances" target="console" track-type="tasks" track-name="consoleLink" track-metadata-position="body" track-metadata-end-goal="viewInstance" class="button button-primary">Go to VM instances</a> </p></li> <li><p>Choose the stopped VM you want to modify from the VM list.</p></li> <li><p>Click <strong>Edit</strong> at the top of the page.</p></li> <li><p>In <strong>Machine configuration</strong>, select <strong>General-purpose</strong>.</p></li> <li><p>In the <strong>Machine type</strong> section, select <strong>Custom</strong>.</p></li> <li><p>Select the number of vCPUs you want.</p></li> <li><p>To add extended memory, select <strong>Extend memory</strong> and then specify the amount of memory you want.</p></li> <li><p>Save your changes.</p></li> </ol></section> <section><h3 id="gcloud_2" data-text=" gcloud " tabindex="-1"> gcloud </h3><p>Use the <a href="/sdk/gcloud/reference/compute/instances/stop"><code translate="no" dir="ltr">gcloud compute instances stop</code> command</a> to stop the VM. Then use the <a href="/sdk/gcloud/reference/compute/instances/set-machine-type"><code translate="no" dir="ltr">gcloud compute instances set-machine-type</code> command</a> with the <code translate="no" dir="ltr">--custom-memory</code> and <code translate="no" dir="ltr">--custom-extensions</code> options to edit the machine&#39;s resources.</p> <p>Save the changes and restart the VM.</p></section> <section><h3 id="go_2" data-text=" Go " tabindex="-1"> Go </h3> <section> <p> Before trying this sample, follow the <span class="notranslate">Go</span> setup instructions in the <a href="/compute/docs/api/using-libraries" track-type="clientLibrariesQuickstart" track-name="go" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/golang-samples/blob//compute/instances/custom-machine-type/update_memory.go" track-metadata-position="compute_custom_machine_type_update_memory">Compute Engine quickstart using client libraries</a>. For more information, see the <a href="/go/docs/reference/cloud.google.com/go/compute/latest/apiv1" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="go" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/golang-samples/blob//compute/instances/custom-machine-type/update_memory.go" track-metadata-region-tag="compute_custom_machine_type_update_memory">Compute Engine <span class="notranslate">Go</span> API reference documentation</a>. </p> <p> To authenticate to Compute Engine, set up Application Default Credentials. For more information, see <a href="/docs/authentication/provide-credentials-adc#local-dev">Set up authentication for a local development environment</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="GoogleCloudPlatform/golang-samples/compute/instances/custom-machine-type/update_memory.go/HEAD/compute_custom_machine_type_update_memory" data-code-snippet="true" data-github-includecode-link="https://github.com/GoogleCloudPlatform/golang-samples/blob/HEAD/compute/instances/custom-machine-type/update_memory.go" feedback-context="{&#34;language&#34;: &#34;go&#34;, &#34;region_tag&#34;: &#34;compute_custom_machine_type_update_memory&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/GoogleCloudPlatform/golang-samples/blob/HEAD/compute/instances/custom-machine-type/update_memory.go&#34;}" feedback-product="1634365" feedback-bucket="infraops" language="go" data-github-path="GoogleCloudPlatform/golang-samples/compute/instances/custom-machine-type/update_memory.go" data-git-revision="HEAD" data-region-tag="compute_custom_machine_type_update_memory" dir="ltr" is-upgraded syntax="Go"><code translate="no" dir="ltr"><span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"context"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"fmt"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"io"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"strings"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">compute</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"cloud.google.com/go/compute/apiv1"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">computepb</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"cloud.google.com/go/compute/apiv1/computepb"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"google.golang.org/protobuf/proto"</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1">// modifyInstanceWithExtendedMemory sends an instance creation request</span> <span class="devsite-syntax-c1">// to the Compute Engine API and waits for it to complete.</span> <span class="devsite-syntax-kd">func</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">modifyInstanceWithExtendedMemory</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">w</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">io</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Writer</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">projectID</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instanceName</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">newMemory</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">error</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// projectID := "your_project_id"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// zone := "europe-central2-b"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// instanceName := "your_instance_name"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// newMemory := 256 // the amount of memory for the VM instance, in megabytes.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">ctx</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">context</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Background</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instancesClient</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">compute</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">NewInstancesRESTClient</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">ctx</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Errorf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"NewInstancesRESTClient: %w"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">defer</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instancesClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Close</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">reqInstance</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span>&amp;<span class="devsite-syntax-nx">computepb</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">GetInstanceRequest</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Project</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">projectID</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Zone</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Instance</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instanceName</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instance</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instancesClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Get</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">ctx</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">reqInstance</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Errorf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"unable to get instance: %w"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">containsString</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">func</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">s</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[]</span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">str</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">bool</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">for</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">_</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">v</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">range</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">s</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">v</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">==</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">str</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">true</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">false</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">!(</span><span class="devsite-syntax-nx">strings</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Contains</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">instance</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">GetMachineType</span><span class="devsite-syntax-p">(),</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"machineTypes/n1-"</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">||</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">strings</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Contains</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">instance</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">GetMachineType</span><span class="devsite-syntax-p">(),</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"machineTypes/n2-"</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">||</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">strings</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Contains</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">instance</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">GetMachineType</span><span class="devsite-syntax-p">(),</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"machineTypes/n2d-"</span><span class="devsite-syntax-p">))</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Errorf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"extra memory is available only for N1, N2 and N2D CPUs"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Make sure that the machine is turned off</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">!</span><span class="devsite-syntax-nx">containsString</span><span class="devsite-syntax-p">([]</span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-s">"TERMINATED"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"STOPPED"</span><span class="devsite-syntax-p">},</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instance</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">GetStatus</span><span class="devsite-syntax-p">())</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">reqStop</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span>&amp;<span class="devsite-syntax-nx">computepb</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">StopInstanceRequest</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Project</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">projectID</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Zone</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Instance</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instanceName</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">op</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instancesClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Stop</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">ctx</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">reqStop</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Errorf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"unable to stop instance: %w"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">op</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Wait</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">ctx</span><span class="devsite-syntax-p">);</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Errorf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"unable to wait for the operation: %w"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Modify the machine definition, remember that extended memory</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// is available only for N1, N2 and N2D CPUs</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">machineType</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instance</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">GetMachineType</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">start</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">machineType</span><span class="devsite-syntax-p">[:</span><span class="devsite-syntax-nx">strings</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">LastIndex</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">machineType</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"-"</span><span class="devsite-syntax-p">)]</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">updateReq</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span>&amp;<span class="devsite-syntax-nx">computepb</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">SetMachineTypeInstanceRequest</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Project</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">projectID</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Zone</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Instance</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instanceName</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">InstancesSetMachineTypeRequestResource</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span>&amp;<span class="devsite-syntax-nx">computepb</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">InstancesSetMachineTypeRequest</span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">MachineType</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">proto</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">String</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Sprintf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"%s-%v-ext"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">start</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">newMemory</span><span class="devsite-syntax-p">)),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">op</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instancesClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">SetMachineType</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">ctx</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">updateReq</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Errorf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"unable to update instance: %w"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">op</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Wait</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">ctx</span><span class="devsite-syntax-p">);</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Errorf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"unable to wait for the operation: %w"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">err</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">fmt</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">Fprintf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">w</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"Instance updated\n"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">nil</span> <span class="devsite-syntax-p">}</span> </code></pre></devsite-code> </div> </section> </section> <section><h3 id="java_2" data-text=" Java " tabindex="-1"> Java </h3> <section> <p> Before trying this sample, follow the <span class="notranslate">Java</span> setup instructions in the <a href="/compute/docs/api/using-libraries" track-type="clientLibrariesQuickstart" track-name="java" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/java-docs-samples/blob//compute/cloud-client/src/main/java/compute/custommachinetype/UpdateMemory.java" track-metadata-position="compute_custom_machine_type_update_memory">Compute Engine quickstart using client libraries</a>. For more information, see the <a href="/java/docs/reference/google-cloud-compute/latest/overview" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="java" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/java-docs-samples/blob//compute/cloud-client/src/main/java/compute/custommachinetype/UpdateMemory.java" track-metadata-region-tag="compute_custom_machine_type_update_memory">Compute Engine <span class="notranslate">Java</span> API reference documentation</a>. </p> <p> To authenticate to Compute Engine, set up Application Default Credentials. For more information, see <a href="/docs/authentication/provide-credentials-adc#local-dev">Set up authentication for a local development environment</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="GoogleCloudPlatform/java-docs-samples/compute/cloud-client/src/main/java/compute/custommachinetype/UpdateMemory.java/HEAD/compute_custom_machine_type_update_memory" data-code-snippet="true" data-github-includecode-link="https://github.com/GoogleCloudPlatform/java-docs-samples/blob/HEAD/compute/cloud-client/src/main/java/compute/custommachinetype/UpdateMemory.java" feedback-context="{&#34;language&#34;: &#34;java&#34;, &#34;region_tag&#34;: &#34;compute_custom_machine_type_update_memory&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/GoogleCloudPlatform/java-docs-samples/blob/HEAD/compute/cloud-client/src/main/java/compute/custommachinetype/UpdateMemory.java&#34;}" feedback-product="1634365" feedback-bucket="infraops" language="java" data-github-path="GoogleCloudPlatform/java-docs-samples/compute/cloud-client/src/main/java/compute/custommachinetype/UpdateMemory.java" data-git-revision="HEAD" data-region-tag="compute_custom_machine_type_update_memory" dir="ltr" is-upgraded syntax="Java"><code translate="no" dir="ltr"> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.api.gax.longrunning.OperationFuture</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.compute.v1.GetInstanceRequest</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.compute.v1.Instance</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.compute.v1.Instance.Status</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.compute.v1.InstancesClient</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.compute.v1.InstancesSetMachineTypeRequest</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.compute.v1.Operation</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.compute.v1.SetMachineTypeInstanceRequest</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.compute.v1.StopInstanceRequest</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">java.io.IOException</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">java.util.concurrent.ExecutionException</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">java.util.concurrent.TimeUnit</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">java.util.concurrent.TimeoutException</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kd">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">class</span> <span class="devsite-syntax-nc">UpdateMemory</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">static</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">void</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nf">main</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-o">[]</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">args</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">throws</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">IOException</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">ExecutionException</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">InterruptedException</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">TimeoutException</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// TODO(developer): Replace these variables before running the sample.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Project ID or project number of the Cloud project you want to use.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">projectId</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"your-google-cloud-project-id"</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Name of the zone to create the instance in. For example: "us-west3-b".</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"google-cloud-zone"</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Name of the new virtual machine (VM) instance.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">instanceName</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"instance-name"</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// The amount of memory for the VM instance, in megabytes.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">newMemory</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">256</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">modifyInstanceWithExtendedMemory</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">projectId</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">instanceName</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">newMemory</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Modify an existing VM to use extended memory and return the modified Instance.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">static</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">void</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nf">modifyInstanceWithExtendedMemory</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">project</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">instanceName</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">int</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">newMemory</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">throws</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">IOException</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">ExecutionException</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">InterruptedException</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">TimeoutException</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Initialize client that will be used to send requests. This client only needs to be created</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// once, and can be reused for multiple requests. After completing all of your requests, call</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// the `instancesClient.close()` method on the client to safely</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// clean up any remaining background resources.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">try</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">InstancesClient</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">instancesClient</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">InstancesClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">create</span><span class="devsite-syntax-p">())</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Create the get instance request object.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">GetInstanceRequest</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">getInstanceRequest</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">GetInstanceRequest</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">newBuilder</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setProject</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">project</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setZone</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setInstance</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">instanceName</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">build</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Instance</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">instance</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">instancesClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">get</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">getInstanceRequest</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Check the machine type.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-o">!</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">instance</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getMachineType</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-na">contains</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"machineTypes/n1-"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">||</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">instance</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getMachineType</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-na">contains</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"machineTypes/n2-"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">||</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">instance</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getMachineType</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-na">contains</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"machineTypes/n2d-"</span><span class="devsite-syntax-p">)))</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"extra memory is available only for N1, N2 and N2D CPUs"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Make sure that the machine is turned off.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-o">!</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">instance</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getStatus</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-na">equals</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">Status</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">TERMINATED</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">toString</span><span class="devsite-syntax-p">())</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">||</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">instance</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getStatus</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-na">equals</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">Status</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">STOPPED</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">toString</span><span class="devsite-syntax-p">())))</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">StopInstanceRequest</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">stopInstanceRequest</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">StopInstanceRequest</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">newBuilder</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setProject</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">project</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setZone</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setInstance</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">instanceName</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">build</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">OperationFuture&lt;Operation</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Operation</span>&gt;<span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">operation</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">instancesClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">stopAsync</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">stopInstanceRequest</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Operation</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">response</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">operation</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">get</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">3</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">TimeUnit</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">MINUTES</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">response</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">hasError</span><span class="devsite-syntax-p">())</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">printf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Unable to stop instance %s"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">response</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getError</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Modify the machine definition. Note that extended memory</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// is available only for N1, N2 and N2D CPUs.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">machineType</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">instance</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getMachineType</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">start</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">machineType</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">substring</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">0</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">machineType</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">lastIndexOf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"-"</span><span class="devsite-syntax-p">));</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Create the machine type instance request object.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">SetMachineTypeInstanceRequest</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">setMachineTypeInstanceRequest</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">SetMachineTypeInstanceRequest</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">newBuilder</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setProject</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">project</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setZone</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setInstance</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">instanceName</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setInstancesSetMachineTypeRequestResource</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">InstancesSetMachineTypeRequest</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">newBuilder</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setMachineType</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">format</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"%s-%d-ext"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">start</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">newMemory</span><span class="devsite-syntax-p">))</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">build</span><span class="devsite-syntax-p">())</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">build</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Invoke the API with the request object and wait for the operation to complete.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Operation</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">response</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">instancesClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setMachineTypeAsync</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">setMachineTypeInstanceRequest</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">get</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">3</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">TimeUnit</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">MINUTES</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Check for errors.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">response</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">hasError</span><span class="devsite-syntax-p">())</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">printf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Unable to update instance %s"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">response</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getError</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Instance updated!"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-p">}</span></code></pre></devsite-code> </div> </section> </section> <section><h3 id="node.js_2" data-text=" Node.js " tabindex="-1"> Node.js </h3> <section> <p> Before trying this sample, follow the <span class="notranslate">Node.js</span> setup instructions in the <a href="/compute/docs/api/using-libraries" track-type="clientLibrariesQuickstart" track-name="nodejs" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob//compute/instances/custom-machine-type/updateMemory.js" track-metadata-position="compute_custom_machine_type_update_memory">Compute Engine quickstart using client libraries</a>. For more information, see the <a href="/nodejs/docs/reference/compute/latest" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="nodejs" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob//compute/instances/custom-machine-type/updateMemory.js" track-metadata-region-tag="compute_custom_machine_type_update_memory">Compute Engine <span class="notranslate">Node.js</span> API reference documentation</a>. </p> <p> To authenticate to Compute Engine, set up Application Default Credentials. For more information, see <a href="/docs/authentication/provide-credentials-adc#local-dev">Set up authentication for a local development environment</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="GoogleCloudPlatform/nodejs-docs-samples/compute/instances/custom-machine-type/updateMemory.js/HEAD/compute_custom_machine_type_update_memory" data-code-snippet="true" data-github-includecode-link="https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/HEAD/compute/instances/custom-machine-type/updateMemory.js" feedback-context="{&#34;language&#34;: &#34;nodejs&#34;, &#34;region_tag&#34;: &#34;compute_custom_machine_type_update_memory&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/HEAD/compute/instances/custom-machine-type/updateMemory.js&#34;}" feedback-product="1634365" feedback-bucket="infraops" language="nodejs" data-github-path="GoogleCloudPlatform/nodejs-docs-samples/compute/instances/custom-machine-type/updateMemory.js" data-git-revision="HEAD" data-region-tag="compute_custom_machine_type_update_memory" dir="ltr" is-upgraded syntax="JavaScript"><code translate="no" dir="ltr"><span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * TODO(developer): Uncomment and replace these variables before running the sample.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-c1">// const projectId = 'YOUR_PROJECT_ID';</span> <span class="devsite-syntax-c1">// const zone = 'europe-central2-b';</span> <span class="devsite-syntax-c1">// const instanceName = 'YOUR_INSTANCE_NAME';</span> <span class="devsite-syntax-c1">// const newMemory = 256;</span> <span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">compute</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">require</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s1">'@google-cloud/compute'</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-k">async</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">function</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">modifyInstanceWithExtendedMemory</span><span class="devsite-syntax-p">()</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instancesClient</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ow">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">compute</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">InstancesClient</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-nx">instance</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">await</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instancesClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">get</span><span class="devsite-syntax-p">({</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">project</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">projectId</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instance</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instanceName</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">});</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-s1">'machineTypes/n1-'</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'machineTypes/n2-'</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'machineTypes/n2d-'</span><span class="devsite-syntax-p">].</span><span class="devsite-syntax-nx">some</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">type</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span>&gt;<span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instance</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">machineType</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">includes</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">type</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">throw</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ow">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ne">Error</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s1">'extra memory is available only for N1, N2 and N2D CPUs'</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Make sure that the machine is turned off</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-o">!</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-s1">'TERMINATED'</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'STOPPED'</span><span class="devsite-syntax-p">].</span><span class="devsite-syntax-nx">some</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">status</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span>&gt;<span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instance</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">status</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">===</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">status</span><span class="devsite-syntax-p">))</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-nx">response</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">await</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instancesClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">stop</span><span class="devsite-syntax-p">({</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">project</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">projectId</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instance</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instanceName</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">});</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">let</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">operation</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">response</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">latestResponse</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">operationsClient</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ow">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">compute</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">ZoneOperationsClient</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Wait for the stop operation to complete.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">while</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">operation</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">status</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!==</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'DONE'</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-nx">operation</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">await</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">operationsClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">wait</span><span class="devsite-syntax-p">({</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">operation</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">operation</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">name</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">project</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">projectId</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">operation</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">split</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s1">'/'</span><span class="devsite-syntax-p">).</span><span class="devsite-syntax-nx">pop</span><span class="devsite-syntax-p">(),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">});</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Modify the machine definition, remember that extended memory</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// is available only for N1, N2 and N2D CPUs</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">start</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instance</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">machineType</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">substring</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">0</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instance</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">machineType</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">lastIndexOf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s1">'-'</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-nx">response</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">await</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instancesClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">setMachineType</span><span class="devsite-syntax-p">({</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">project</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">projectId</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instance</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instanceName</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">instancesSetMachineTypeRequestResource</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">machineType</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-sb">`</span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">start</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">-</span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">newMemory</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">-ext`</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">});</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">let</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">operation</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">response</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">latestResponse</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">operationsClient</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ow">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">compute</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">ZoneOperationsClient</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Wait for the update operation to complete.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">while</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">operation</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">status</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!==</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'DONE'</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-nx">operation</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">await</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">operationsClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">wait</span><span class="devsite-syntax-p">({</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">operation</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">operation</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">name</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">project</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">projectId</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">operation</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">zone</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">split</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s1">'/'</span><span class="devsite-syntax-p">).</span><span class="devsite-syntax-nx">pop</span><span class="devsite-syntax-p">(),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">});</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s1">'Instance updated.'</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-p">}</span> <span class="devsite-syntax-nx">modifyInstanceWithExtendedMemory</span><span class="devsite-syntax-p">();</span></code></pre></devsite-code> </div> </section> </section> <section><h3 id="python_2" data-text=" Python " tabindex="-1"> Python </h3> <section> <p> Before trying this sample, follow the <span class="notranslate">Python</span> setup instructions in the <a href="/compute/docs/api/using-libraries" track-type="clientLibrariesQuickstart" track-name="python" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/python-docs-samples/blob//compute/client_library/snippets/instances/custom_machine_types/update_memory.py" track-metadata-position="compute_custom_machine_type_update_memory">Compute Engine quickstart using client libraries</a>. For more information, see the <a href="/python/docs/reference/compute/latest" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="python" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/python-docs-samples/blob//compute/client_library/snippets/instances/custom_machine_types/update_memory.py" track-metadata-region-tag="compute_custom_machine_type_update_memory">Compute Engine <span class="notranslate">Python</span> API reference documentation</a>. </p> <p> To authenticate to Compute Engine, set up Application Default Credentials. For more information, see <a href="/docs/authentication/provide-credentials-adc#local-dev">Set up authentication for a local development environment</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="GoogleCloudPlatform/python-docs-samples/compute/client_library/snippets/instances/custom_machine_types/update_memory.py/HEAD/compute_custom_machine_type_update_memory" data-code-snippet="true" data-github-includecode-link="https://github.com/GoogleCloudPlatform/python-docs-samples/blob/HEAD/compute/client_library/snippets/instances/custom_machine_types/update_memory.py" feedback-context="{&#34;language&#34;: &#34;python&#34;, &#34;region_tag&#34;: &#34;compute_custom_machine_type_update_memory&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/GoogleCloudPlatform/python-docs-samples/blob/HEAD/compute/client_library/snippets/instances/custom_machine_types/update_memory.py&#34;}" feedback-product="1634365" feedback-bucket="infraops" language="python" data-github-path="GoogleCloudPlatform/python-docs-samples/compute/client_library/snippets/instances/custom_machine_types/update_memory.py" data-git-revision="HEAD" data-region-tag="compute_custom_machine_type_update_memory" dir="ltr" is-upgraded syntax="Python"><code translate="no" dir="ltr"><span class="devsite-syntax-kn">from</span> <span class="devsite-syntax-nn">__future__</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-n">annotations</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-nn">sys</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-nn">time</span> <span class="devsite-syntax-kn">from</span> <span class="devsite-syntax-nn">typing</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-n">Any</span> <span class="devsite-syntax-kn">from</span> <span class="devsite-syntax-nn">google.api_core.extended_operation</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-n">ExtendedOperation</span> <span class="devsite-syntax-kn">from</span> <span class="devsite-syntax-nn">google.cloud</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-n">compute_v1</span> <span class="devsite-syntax-k">def</span> <span class="devsite-syntax-nf">wait_for_extended_operation</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">operation</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-n">ExtendedOperation</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">verbose_name</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-s2">"operation"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">timeout</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">int</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-mi">300</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-o">-</span>&gt; <span class="devsite-syntax-n">Any</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sd">"""</span> <span class="devsite-syntax-sd"> Waits for the extended (long-running) operation to complete.</span> <span class="devsite-syntax-sd"> If the operation is successful, it will return its result.</span> <span class="devsite-syntax-sd"> If the operation ends with an error, an exception will be raised.</span> <span class="devsite-syntax-sd"> If there were any warnings during the execution of the operation</span> <span class="devsite-syntax-sd"> they will be printed to sys.stderr.</span> <span class="devsite-syntax-sd"> Args:</span> <span class="devsite-syntax-sd"> operation: a long-running operation you want to wait on.</span> <span class="devsite-syntax-sd"> verbose_name: (optional) a more verbose name of the operation,</span> <span class="devsite-syntax-sd"> used only during error and warning reporting.</span> <span class="devsite-syntax-sd"> timeout: how long (in seconds) to wait for operation to finish.</span> <span class="devsite-syntax-sd"> If None, wait indefinitely.</span> <span class="devsite-syntax-sd"> Returns:</span> <span class="devsite-syntax-sd"> Whatever the operation.result() returns.</span> <span class="devsite-syntax-sd"> Raises:</span> <span class="devsite-syntax-sd"> This method will raise the exception received from `operation.exception()`</span> <span class="devsite-syntax-sd"> or RuntimeError if there is no exception set, but there is an `error_code`</span> <span class="devsite-syntax-sd"> set for the `operation`.</span> <span class="devsite-syntax-sd"> In case of an operation taking longer than `timeout` seconds to complete,</span> <span class="devsite-syntax-sd"> a `concurrent.futures.TimeoutError` will be raised.</span> <span class="devsite-syntax-sd"> """</span> <span class="devsite-syntax-n">result</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">operation</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">result</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">timeout</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">timeout</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">operation</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">error_code</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Error during </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">verbose_name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">: [Code: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">operation</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">error_code</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">]: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">operation</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">error_message</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">file</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">sys</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">stderr</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">flush</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-kc">True</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Operation ID: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">operation</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">file</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">sys</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">stderr</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">flush</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-kc">True</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">raise</span> <span class="devsite-syntax-n">operation</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">exception</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-ow">or</span> <span class="devsite-syntax-ne">RuntimeError</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">operation</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">error_message</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">operation</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">warnings</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Warnings during </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">verbose_name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">:</span><span class="devsite-syntax-se">\n</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">file</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">sys</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">stderr</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">flush</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-kc">True</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">for</span> <span class="devsite-syntax-n">warning</span> <span class="devsite-syntax-ow">in</span> <span class="devsite-syntax-n">operation</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">warnings</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">" - </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">warning</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">code</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">warning</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">message</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">file</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">sys</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">stderr</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">flush</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-kc">True</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">return</span> <span class="devsite-syntax-n">result</span> <span class="devsite-syntax-k">def</span> <span class="devsite-syntax-nf">add_extended_memory_to_instance</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">project_id</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">instance_name</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">str</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">new_memory</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">int</span> <span class="devsite-syntax-p">):</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sd">"""</span> <span class="devsite-syntax-sd"> Modify an existing VM to use extended memory.</span> <span class="devsite-syntax-sd"> Args:</span> <span class="devsite-syntax-sd"> project_id: project ID or project number of the Cloud project you want to use.</span> <span class="devsite-syntax-sd"> zone: name of the zone to create the instance in. For example: "us-west3-b"</span> <span class="devsite-syntax-sd"> instance_name: name of the new virtual machine (VM) instance.</span> <span class="devsite-syntax-sd"> new_memory: the amount of memory for the VM instance, in megabytes.</span> <span class="devsite-syntax-sd"> Returns:</span> <span class="devsite-syntax-sd"> Instance object.</span> <span class="devsite-syntax-sd"> """</span> <span class="devsite-syntax-n">instance_client</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">compute_v1</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">InstancesClient</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-n">instance</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">instance_client</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">get</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">project</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">project_id</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">zone</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">instance_name</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-ow">not</span> <span class="devsite-syntax-p">(</span> <span class="devsite-syntax-s2">"n1-"</span> <span class="devsite-syntax-ow">in</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">machine_type</span> <span class="devsite-syntax-ow">or</span> <span class="devsite-syntax-s2">"n2-"</span> <span class="devsite-syntax-ow">in</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">machine_type</span> <span class="devsite-syntax-ow">or</span> <span class="devsite-syntax-s2">"n2d-"</span> <span class="devsite-syntax-ow">in</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">machine_type</span> <span class="devsite-syntax-p">):</span> <span class="devsite-syntax-k">raise</span> <span class="devsite-syntax-ne">RuntimeError</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s2">"Extra memory is available only for N1, N2 and N2D CPUs."</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Make sure that the machine is turned off</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">status</span> <span class="devsite-syntax-ow">not</span> <span class="devsite-syntax-ow">in</span> <span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">Status</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">TERMINATED</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">Status</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">STOPPED</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">):</span> <span class="devsite-syntax-n">operation</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">instance_client</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">stop</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">project</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">project_id</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">zone</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">instance_name</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-n">wait_for_extended_operation</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">operation</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"instance stopping"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-n">start</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">time</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">time</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-k">while</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">status</span> <span class="devsite-syntax-ow">not</span> <span class="devsite-syntax-ow">in</span> <span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">Status</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">TERMINATED</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">Status</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">STOPPED</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">):</span> <span class="devsite-syntax-c1"># Waiting for the instance to be turned off.</span> <span class="devsite-syntax-n">instance</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">instance_client</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">get</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">project</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">project_id</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">zone</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">instance_name</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-n">time</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">sleep</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">2</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">time</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">time</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-o">-</span> <span class="devsite-syntax-n">start</span> &gt;<span class="devsite-syntax-o">=</span> <span class="devsite-syntax-mi">300</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-c1"># 5 minutes</span> <span class="devsite-syntax-k">raise</span> <span class="devsite-syntax-ne">TimeoutError</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-c1"># Modify the machine definition, remember that extended memory is available only for N1, N2 and N2D CPUs</span> <span class="devsite-syntax-n">start</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">end</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">machine_type</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">rsplit</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s2">"-"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">maxsplit</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-mi">1</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">machine_type</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">start</span> <span class="devsite-syntax-o">+</span> <span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"-</span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">new_memory</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">-ext"</span> <span class="devsite-syntax-c1"># TODO: If you prefer to use the CustomMachineType helper class, uncomment this code and comment the 2 lines above</span> <span class="devsite-syntax-c1"># Using CustomMachineType helper</span> <span class="devsite-syntax-c1"># cmt = CustomMachineType.from_str(instance.machine_type)</span> <span class="devsite-syntax-c1"># cmt.memory_mb = new_memory</span> <span class="devsite-syntax-c1"># cmt.extra_memory_used = True</span> <span class="devsite-syntax-c1"># instance.machine_type = str(cmt)</span> <span class="devsite-syntax-n">operation</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">instance_client</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">update</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-n">project</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">project_id</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">zone</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">instance_name</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">instance_resource</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">instance</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-n">wait_for_extended_operation</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">operation</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"instance update"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">return</span> <span class="devsite-syntax-n">instance_client</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">get</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">project</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">project_id</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">zone</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">zone</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">instance</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-n">instance_name</span><span class="devsite-syntax-p">)</span> </code></pre></devsite-code> </div> </section> </section> <section><h3 id="rest_2" data-text=" REST " tabindex="-1"> REST </h3><p>Use the <a href="/compute/docs/reference/latest/instances/stop"><code translate="no" dir="ltr">instances.stop</code> method</a> then use the <a href="/compute/docs/reference/latest/instances/setMachineType"><code translate="no" dir="ltr">instances.setMachineType</code> method</a> to edit the machine type resources.</p> <p>Once you stop the instance, edit the <code translate="no" dir="ltr">machineTypes</code> option with your changes.</p> <p>{</p> <p>&quot;name&quot;: &quot;<var translate="no">INSTANCE_NAME</var>&quot;, &quot;machineType&quot;: &quot;zones/<var translate="no">ZONE</var>/machineTypes/<var translate="no">MACHINE_TYPE</var>&quot;,</p> <p>... }</p> <p>Replace the following:</p> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded syntax="reStructuredText"><code translate="no" dir="ltr"><span class="devsite-syntax-m">+</span> <var translate="no">INSTANCE_NAME</var>: The name of the VM <span class="devsite-syntax-m">+</span> <var translate="no">ZONE</var>: The zone where your VMs reside <span class="devsite-syntax-m">+</span> <var translate="no">MACHINE_TYPE</var>: The name of the VM </code></pre></devsite-code></section> </div> <h2 id="whats_next" data-text="What's next" tabindex="-1">What's next</h2> <ul> <li>Learn more about <a href="/compute/docs/machine-resource">machine families</a>.</li> <li>After creating a VM, step through a <a href="/compute/docs#training-and-tutorials">tutorial</a> to start using a VM instance.</li> <li>Learn how to <a href="/compute/docs/instances/connecting-to-instance">connect to your VM instance</a>.</li> </ul> <devsite-hats-survey class="nocontent" hats-id="4a78eE2Yw0j6coqRkdD0UcJAGSiv" listnr-id="81820"></devsite-hats-survey> </div> <devsite-thumb-rating position="footer"> </devsite-thumb-rating> <devsite-feedback position="footer" project-name="Compute Engine Documentation" product-id="81820" bucket="documentation" context="" version="t-devsite-webserver-20241114-r00-rc02.464922260396498922" data-label="Send Feedback Button" track-type="feedback" track-name="sendFeedbackLink" track-metadata-position="footer" class="nocontent" project-feedback-url="https://issuetracker.google.com/issues/new?component=187134&amp;template=0" project-icon="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/images/favicons/onecloud/super_cloud.png" > <button> Send feedback </button> </devsite-feedback> <div class="devsite-floating-action-buttons"> </div> </article> <devsite-content-footer class="nocontent"> <p>Except as otherwise noted, the content of this page is licensed under the <a href="https://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 License</a>, and code samples are licensed under the <a href="https://www.apache.org/licenses/LICENSE-2.0">Apache 2.0 License</a>. For details, see the <a href="https://developers.google.com/site-policies">Google Developers Site Policies</a>. Java is a registered trademark of Oracle and/or its affiliates.</p> <p>Last updated 2024-11-22 UTC.</p> </devsite-content-footer> <devsite-notification > </devsite-notification> <div class="devsite-content-data"> <template class="devsite-thumb-rating-feedback"> <devsite-feedback position="thumb-rating" project-name="Compute Engine Documentation" product-id="81820" bucket="documentation" context="" version="t-devsite-webserver-20241114-r00-rc02.464922260396498922" data-label="Send Feedback Button" track-type="feedback" track-name="sendFeedbackLink" track-metadata-position="thumb-rating" class="nocontent" project-feedback-url="https://issuetracker.google.com/issues/new?component=187134&amp;template=0" project-icon="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/images/favicons/onecloud/super_cloud.png" > <button> Need to tell us more? </button> </devsite-feedback> </template> <template class="devsite-content-data-template"> [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-11-22 UTC."],[],[]] </template> </div> </devsite-content> </main> <devsite-footer-promos class="devsite-footer"> </devsite-footer-promos> <devsite-footer-linkboxes class="devsite-footer"> <nav class="devsite-footer-linkboxes nocontent" aria-label="Footer links"> <ul class="devsite-footer-linkboxes-list"> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">Why Google</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="/why-google-cloud/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 1)" track-type="footer link"track-name="choosing google cloud"track-metadata-module="footer"track-metadata-position="footer"track-metadata-child_headline="why google"track-metadata-eventDetail="cloud.google.com/why-google-cloud/"> Choosing Google Cloud </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/trust-center/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 2)" track-metadata-position="footer"track-metadata-eventDetail="cloud.google.com/security/"track-metadata-child_headline="why google"track-metadata-module="footer"track-type="footer link"track-name="trust and security"> Trust and security </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/modern-infrastructure/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 3)" track-name="modern infrastructure cloud"track-metadata-eventDetail="cloud.google.com/solutions/modern-infrastructure/"track-metadata-module="footer"track-type="footer link"track-metadata-position="footer"track-metadata-child_headline="why google"> Modern Infrastructure Cloud </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/multicloud/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 4)" track-metadata-module="footer"track-name="multicloud"track-metadata-eventDetail="cloud.google.com/multicloud/"track-metadata-child_headline="why google"track-type="footer link"track-metadata-position="footer"> Multicloud </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/infrastructure/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 5)" track-metadata-position="footer"track-type="footer link"track-metadata-eventDetail="cloud.google.com/infrastructure/"track-name="global infrastructure"track-metadata-child_headline="why google"track-metadata-module="footer"> Global infrastructure </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/customers/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 6)" track-type="footer link"track-metadata-eventDetail="cloud.google.com/customers/"track-metadata-child_headline="why google"track-name="customers and case studies"track-metadata-module="footer"track-metadata-position="footer"> Customers and case studies </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/analyst-reports/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 7)" track-metadata-position="footer"track-name="analyst reports"track-metadata-module="footer"track-type="footer link"track-metadata-eventDetail="cloud.google.com/analyst-reports/"track-metadata-child_headline="why google"> Analyst reports </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/whitepapers/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 8)" track-type="footer link"track-metadata-position="footer"track-metadata-module="footer"track-metadata-eventDetail="cloud.google.com/whitepapers/"track-metadata-child_headline="why google"track-name="whitepapers"> Whitepapers </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//cloud.google.com/blog/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 9)" track-metadata-child_headline="engage"track-type="footer link"track-metadata-position="footer"track-metadata-eventDetail="cloud.google.com/blog/"track-name="blog"track-metadata-module="footer"> Blog </a> </li> </ul> </li> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">Products and pricing</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="/pricing/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 1)" track-name="google cloud pricing"track-metadata-eventDetail="cloud.google.com/pricing/"track-metadata-child_headline="products and pricing"track-type="footer link"track-metadata-module="footer"track-metadata-position="footer"> Google Cloud pricing </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//workspace.google.com/pricing.html" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 2)" track-metadata-module="footer"track-name="google workspace pricing"track-metadata-position="footer"track-metadata-eventDetail="workspace.google.com/pricing.html"track-metadata-child_headline="products and pricing"track-type="footer link"target="_blank"> Google Workspace pricing </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/products/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 3)" track-metadata-child_headline="products and pricing"track-metadata-module="footer"track-name="see all products"track-metadata-position="footer"track-type="footer link"track-metadata-eventDetail="cloud.google.com/products/"> See all products </a> </li> </ul> </li> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">Solutions</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="/solutions/infrastructure-modernization/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 1)" track-type="footer link"track-metadata-eventDetail="cloud.google.com/solutions/infrastructure-modernization/"track-metadata-child_headline="solutions"track-metadata-module="footer"track-metadata-position="footer"track-name="infrastructure modernization"> Infrastructure modernization </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/databases/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 2)" track-metadata-child_headline="solutions"track-type="footer link"track-metadata-eventDetail="cloud.google.com/solutions/databases"track-metadata-position="footer"track-metadata-module="footer"track-name="databases"> Databases </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/application-modernization/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 3)" track-metadata-eventDetail="cloud.google.com/solutions/application-modernization/"track-metadata-position="footer"track-metadata-module="footer"track-type="footer link"track-name="application development"track-metadata-child_headline="solutions"> Application modernization </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/smart-analytics/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 4)" track-name="smart analytics"track-metadata-position="footer"track-metadata-child_headline="solutions"track-type="footer link"track-metadata-module="footer"track-metadata-eventDetail="cloud.google.com/solutions/smart-analytics/"> Smart analytics </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/ai/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 5)" track-metadata-position="footer"track-metadata-module="footer"track-metadata-eventDetail="cloud.google.com/solutions/ai/"track-metadata-child_headline="solutions"track-type="footer link"track-name="artificial intelligence"> Artificial Intelligence </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/security/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 6)" track-type="footer link"track-name="security"track-metadata-module="footer"track-metadata-position="footer"track-metadata-eventDetail="cloud.google.com/solutions/security/"track-metadata-child_headline="solutions"> Security </a> </li> <li class="devsite-footer-linkbox-item"> <a href="https://workspace.google.com/enterprise/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 7)" track-metadata-child_headline="solutions"track-metadata-eventDetail="workspace.google.com/enterprise/"track-metadata-module="footer"target="_blank"track-type="footer link"track-name="productivity and work transformation"track-metadata-position="footer"> Productivity & work transformation </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/#industry-solutions" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 8)" track-metadata-child_headline="solutions"track-name="industry solutions"track-type="footer link"track-metadata-position="footer"track-metadata-eventDetail="cloud.google.com/solutions/#industry-solutions"track-metadata-module="footer"> Industry solutions </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/devops/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 9)" track-name="devops solutions"track-metadata-eventDetail="cloud.google.com/solutions/devops/"track-type="footer link"track-metadata-position="footer"track-metadata-child_headline="solutions"track-metadata-module="footer"> DevOps solutions </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/#section-14" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 10)" track-type="footer link"track-name="small business solutions"track-metadata-child_headline="solutions"track-metadata-position="footer"track-metadata-eventDetail="cloud.google.com/solutions/#section-14"track-metadata-module="footer"> Small business solutions </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 11)" track-metadata-module="footer"track-metadata-eventDetail="cloud.google.com/solutions/"track-name="see all solutions"track-type="footer link"track-metadata-child_headline="solutions"track-metadata-position="footer"> See all solutions </a> </li> </ul> </li> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">Resources</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="/affiliate-program/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 1)" track-name="google cloud affiliate program"track-metadata-position="footer"track-metadata-eventDetail="cloud.google.com/affiliate-program/"track-metadata-child_headline="resources"track-metadata-module="footer"track-type="footer link"> Google Cloud Affiliate Program </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/docs/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 2)" track-type="footer link"track-metadata-position="footer"track-metadata-module="footer"track-metadata-eventDetail="cloud.google.com/docs/"track-name="google cloud documentation"track-metadata-child_headline="resources"> Google Cloud documentation </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/docs/get-started/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 3)" track-metadata-position="footer"track-name="google cloud quickstarts"track-type="footer link"track-metadata-module="footer"track-metadata-eventDetail="cloud.google.com/docs/get-started/"track-metadata-child_headline="resources"> Google Cloud quickstarts </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/marketplace/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 4)" track-metadata-child_headline="resources"track-metadata-eventDetail="cloud.google.com/marketplace/"track-metadata-position="footer"track-type="footer link"track-metadata-module="footer"track-name="google cloud marketplace"> Google Cloud Marketplace </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/discover/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 5)" track-type="footer link"track-name="learn about cloud computing"track-metadata-position="footer"track-metadata-child_headline="resources"track-metadata-eventDetail="learn/"track-metadata-module="footer"> Learn about cloud computing </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/support-hub/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 6)" track-metadata-module="footer"track-name="support"track-metadata-eventDetail="cloud.google.com/support-hub/"track-metadata-child_headline="resources"track-metadata-position="footer"track-type="footer link"> Support </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/docs/samples" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 7)" track-name="code samples"track-metadata-module="footer"track-type="footer link"track-metadata-eventDetail="cloud.google.com/docs/samples"track-metadata-position="footer"track-metadata-child_headline="resources"> Code samples </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/architecture/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 8)" track-type="footer link"track-metadata-eventDetail="cloud.google.com/architecture/"track-metadata-module="footer"track-metadata-position="footer"track-metadata-child_headline="resources"track-name="cloud architecture center"> Cloud Architecture Center </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/learn/training/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 9)" track-metadata-child_headline="resources"track-name="training"track-metadata-eventDetail="cloud.google.com/training/"track-metadata-module="footer"track-metadata-position="footer"track-type="footer link"> Training </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/learn/certification/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 10)" track-type="footer link"track-metadata-eventDetail="cloud.google.com/certification"track-metadata-position="footer"track-name="certifications"track-metadata-child_headline="resources"track-metadata-module="footer"> Certifications </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//developers.google.com" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 11)" target="_blank"track-metadata-position="footer"track-metadata-child_headline="resources"track-metadata-module="footer"track-name="google developers"track-type="footer link"track-metadata-eventDetail="developers.google.com"> Google for Developers </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/startup/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 12)" track-metadata-child_headline="resources"track-metadata-position="footer"track-type="footer link"track-metadata-module="footer"track-name="google cloud for startups"track-metadata-eventDetail="cloud.google.com/startup/"> Google Cloud for Startups </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//status.cloud.google.com" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 13)" track-metadata-child_headline="resources"target="_blank"track-metadata-module="footer"track-metadata-position="footer"track-name="system status"track-metadata-eventDetail="status.cloud.google.com"track-type="footer link"> System status </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/release-notes" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 14)" track-metadata-module="footer"track-metadata-eventDetail="cloud.google.com/release-notes/"track-metadata-child_headline="resources"track-type="footer link"track-name="release notes"track-metadata-position="footer"> Release Notes </a> </li> </ul> </li> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">Engage</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="/contact/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 1)" track-metadata-module="footer"track-metadata-position="footer"track-name="contact sales"track-metadata-child_headline="engage"track-type="footer link"track-metadata-eventDetail="cloud.google.com/contact/"> Contact sales </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//cloud.google.com/find-a-partner" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 2)" track-metadata-position="footer"track-type="footer link"track-metadata-module="footer"track-name="find a partner"track-metadata-eventDetail="cloud.google.com/find-a-partner"track-metadata-child_headline="engage"target="_blank"> Find a Partner </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/partners/become-a-partner/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 3)" track-name="become a partner"track-metadata-child_headline="engage"track-type="footer link"track-metadata-eventDetail="cloud.google.com/partners/become-a-partner/"track-metadata-position="footer"track-metadata-module="footer"> Become a Partner </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/events/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 4)" track-metadata-child_headline="engage"track-type="footer link"track-metadata-module="footer"track-metadata-eventDetail="cloud.withgoogle.com/events"track-metadata-position="footer"track-name="events"> Events </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/podcasts/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 5)" rel="noopener"track-metadata-module="footer"track-metadata-eventDetail="cloud.google.com/podcasts/"target="_blank"track-metadata-position="footer"track-metadata-child_headline="engage"track-type="footer link"track-name="podcasts"> Podcasts </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/developers/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 6)" track-metadata-module="footer"track-metadata-eventDetail="cloud.google.com/developers/"track-metadata-child_headline="engage"track-type="footer link"track-metadata-position="footer"track-name="developer center"> Developer Center </a> </li> <li class="devsite-footer-linkbox-item"> <a href="https://www.googlecloudpresscorner.com/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 7)" track-name="press corner"track-metadata-eventDetail="www.googlecloudpresscorner.com"track-metadata-module="footer"track-metadata-position="footer"rel="noopener"target="_blank"track-type="footer link"track-metadata-child_headline="engage"> Press Corner </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//www.youtube.com/googlecloud" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 8)" track-name="google cloud on youtube"track-metadata-position="footer"track-metadata-eventDetail="www.youtube.com/googlecloud"target="_blank"track-metadata-module="footer"rel="noopener"track-type="footer link"track-metadata-child_headline="engage"> Google Cloud on YouTube </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//www.youtube.com/googlecloudplatform" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 9)" track-metadata-eventDetail="www.youtube.com/googlecloudplatform"rel="noopener"track-metadata-module="footer"track-name="google cloud tech on youtube"track-metadata-child_headline="engage"target="_blank"track-metadata-position="footer"track-type="footer link"> Google Cloud Tech on YouTube </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//x.com/googlecloud" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 10)" target="_blank"track-metadata-child_headline="engage"track-metadata-module="footer"track-metadata-eventDetail="x.com/googlecloud"track-metadata-position="footer"track-name="follow on x"track-type="footer link"rel="noopener"> Follow on X </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//userresearch.google.com/?reserved=1&amp;utm_source=website&amp;Q_Language=en&amp;utm_medium=own_srch&amp;utm_campaign=CloudWebFooter&amp;utm_term=0&amp;utm_content=0&amp;productTag=clou&amp;campaignDate=jul19&amp;pType=devel&amp;referral_code=jk212693" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 11)" track-metadata-eventDetail="userresearch.google.com/?reserved=1&amp;utm_source=website&amp;Q_Language=en&amp;utm_medium=own_srch&amp;utm_campaign=CloudWebFooter&amp;utm_term=0&amp;utm_content=0&amp;productTag=clou&amp;campaignDate=jul19&amp;pType=devel&amp;referral_code=jk212693"target="_blank"track-name="join user research"track-metadata-position="footer"track-metadata-module="footer"track-type="footer link"track-metadata-child_headline="engage"> Join User Research </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//careers.google.com/cloud" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 12)" track-type="footer link"track-metadata-module="footer"track-metadata-position="footer"track-name="we are hiring join google cloud"track-metadata-eventDetail="careers.google.com/cloud"track-metadata-child_headline="engage"target="_blank"> We're hiring. Join Google Cloud! </a> </li> <li class="devsite-footer-linkbox-item"> <a href="https://www.googlecloudcommunity.com/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 13)" rel="noopener"track-metadata-child_headline="engage"track-metadata-position="footer"track-metadata-module="footer"target="_blank"track-metadata-eventDetail="www.googlecloudcommunity.com"track-type="footer link"track-name="google cloud community"> Google Cloud Community </a> </li> </ul> </li> </ul> </nav> </devsite-footer-linkboxes> <devsite-footer-utility class="devsite-footer"> <div class="devsite-footer-utility nocontent"> <nav class="devsite-footer-utility-links" aria-label="Utility links"> <ul class="devsite-footer-utility-list"> <li class="devsite-footer-utility-item "> <a class="devsite-footer-utility-link gc-analytics-event" href="//about.google/" data-category="Site-Wide Custom Events" data-label="Footer About Google link" track-type="footer link" track-metadata-position="footer" track-metadata-module="utility footer" track-metadata-eventDetail="//about.google/" track-name="about google" target="_blank" > About Google </a> </li> <li class="devsite-footer-utility-item devsite-footer-privacy-link"> <a class="devsite-footer-utility-link gc-analytics-event" href="//policies.google.com/privacy" data-category="Site-Wide Custom Events" data-label="Footer Privacy link" track-metadata-position="footer" track-metadata-module="utility footer" track-type="footer link" track-name="privacy" track-metadata-eventDetail="//policies.google.com/privacy" target="_blank" > Privacy </a> </li> <li class="devsite-footer-utility-item "> <a class="devsite-footer-utility-link gc-analytics-event" href="//www.google.com/intl/en/policies/terms/regional.html" data-category="Site-Wide Custom Events" data-label="Footer Site terms link" target="_blank" track-name="site terms" track-metadata-eventDetail="//www.google.com/intl/en/policies/terms/regional.html" track-metadata-module="utility footer" track-type="footer link" track-metadata-position="footer" > Site terms </a> </li> <li class="devsite-footer-utility-item "> <a class="devsite-footer-utility-link gc-analytics-event" href="/product-terms/" data-category="Site-Wide Custom Events" data-label="Footer Google Cloud terms link" track-type="footer link" track-name="google cloud terms" track-metadata-position="footer" track-metadata-module="utility footer" track-metadata-eventDetail="/product-terms/" > Google Cloud terms </a> </li> <li class="devsite-footer-utility-item glue-cookie-notification-bar-control"> <a class="devsite-footer-utility-link gc-analytics-event" href="#" data-category="Site-Wide Custom Events" data-label="Footer Manage cookies link" track-metadata-module="utility footer" track-metadata-eventDetail="#" track-name="Manage cookies" aria-hidden="true" track-metadata-position="footer" track-type="footer link" > Manage cookies </a> </li> <li class="devsite-footer-utility-item devsite-footer-carbon-button"> <a class="devsite-footer-utility-link gc-analytics-event" href="/sustainability" data-category="Site-Wide Custom Events" data-label="Footer Our third decade of climate action: join us link" track-type="footer link" track-name="Our third decade of climate action: join us" track-metadata-eventDetail="/sustainability/" track-metadata-module="utility footer" track-metadata-position="footer" > Our third decade of climate action: join us </a> </li> <li class="devsite-footer-utility-item devsite-footer-utility-button"> <span class="devsite-footer-utility-description">Sign up for the Google Cloud newsletter</span> <a class="devsite-footer-utility-link gc-analytics-event" href="/newsletter/" data-category="Site-Wide Custom Events" data-label="Footer Subscribe link" track-metadata-module="utility footer" track-metadata-eventDetail="/newsletter/" track-metadata-position="footer" track-name="subscribe" track-type="footer link" > Subscribe </a> </li> </ul> <devsite-language-selector> <ul role="presentation"> <li role="presentation"> <a role="menuitem" lang="en" >English</a> </li> <li role="presentation"> <a role="menuitem" lang="de" >Deutsch</a> </li> <li role="presentation"> <a role="menuitem" lang="es_419" >Español – América Latina</a> </li> <li role="presentation"> <a role="menuitem" lang="fr" >Français</a> </li> <li role="presentation"> <a role="menuitem" lang="id" >Indonesia</a> </li> <li role="presentation"> <a role="menuitem" lang="it" >Italiano</a> </li> <li role="presentation"> <a role="menuitem" lang="pt_br" >Português – Brasil</a> </li> <li role="presentation"> <a role="menuitem" lang="zh_cn" >中文 – 简体</a> </li> <li role="presentation"> <a role="menuitem" lang="ja" >日本語</a> </li> <li role="presentation"> <a role="menuitem" lang="ko" >한국어</a> </li> </ul> </devsite-language-selector> </nav> </div> </devsite-footer-utility> <devsite-panel></devsite-panel> </section></section> <devsite-sitemask></devsite-sitemask> <devsite-snackbar></devsite-snackbar> <devsite-tooltip ></devsite-tooltip> <devsite-heading-link></devsite-heading-link> <devsite-analytics> <script type="application/json" analytics>[]</script> <script type="application/json" tag-management>{&#34;at&#34;: &#34;True&#34;, &#34;ga4&#34;: [], &#34;ga4p&#34;: [], &#34;gtm&#34;: [{&#34;id&#34;: &#34;GTM-5CVQBG&#34;, &#34;purpose&#34;: 1}], &#34;parameters&#34;: {&#34;internalUser&#34;: &#34;False&#34;, &#34;language&#34;: {&#34;machineTranslated&#34;: &#34;False&#34;, &#34;requested&#34;: &#34;en&#34;, &#34;served&#34;: &#34;en&#34;}, &#34;pageType&#34;: &#34;article&#34;, &#34;projectName&#34;: &#34;Compute Engine Documentation&#34;, &#34;signedIn&#34;: &#34;False&#34;, &#34;tenant&#34;: &#34;cloud&#34;, &#34;recommendations&#34;: {&#34;sourcePage&#34;: &#34;&#34;, &#34;sourceType&#34;: 0, &#34;sourceRank&#34;: 0, &#34;sourceIdenticalDescriptions&#34;: 0, &#34;sourceTitleWords&#34;: 0, &#34;sourceDescriptionWords&#34;: 0, &#34;experiment&#34;: &#34;&#34;}, &#34;experiment&#34;: {&#34;ids&#34;: &#34;&#34;}}}</script> </devsite-analytics> <devsite-badger></devsite-badger> <cloudx-user></cloudx-user> <cloudx-free-trial-eligible-store freeTrialEligible='true'></cloudx-free-trial-eligible-store> <cloudx-pricing-socket></cloudx-pricing-socket> <cloudx-experiments type="TestAACodivertedExperiment" path="/virtual/TestAACodivertedExperiment/configureExperiment" location="SG" variant="variant2" ></cloudx-experiments> <cloudx-experiment-ids userCountry="SG" devsiteExperimentIdList="[39300012, 39300022, 39300118, 39300196, 39300251, 39300317, 39300320, 39300326, 39300345, 39300354, 39300363, 39300373, 39300412, 39300421, 39300436, 39300473, 39300487, 39300496, 39300498]"> </cloudx-experiment-ids> <script nonce="YFl72ofQJWUtAFsqP9itsoPFOrc+vR"> (function(d,e,v,s,i,t,E){d['GoogleDevelopersObject']=i; t=e.createElement(v);t.async=1;t.src=s;E=e.getElementsByTagName(v)[0]; E.parentNode.insertBefore(t,E);})(window, document, 'script', 'https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/js/app_loader.js', '[2,"en",null,"/js/devsite_app_module.js","https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625","https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud","https://cloud-dot-devsite-v2-prod.appspot.com",null,null,["/_pwa/cloud/manifest.json","https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/images/video-placeholder.svg","https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/images/favicons/onecloud/favicon.ico","https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/images/cloud-logo.svg","https://fonts.googleapis.com/css?family=Google+Sans:400,500,700|Google+Sans+Text:400,400italic,500,500italic,700,700italic|Roboto:400,400italic,500,500italic,700,700italic|Roboto+Mono:400,500,700&display=swap"],1,null,[1,6,8,12,14,17,21,25,50,52,63,70,75,76,80,87,91,92,93,97,98,100,101,102,103,104,105,107,108,109,110,112,113,117,118,120,122,124,125,126,127,129,130,131,132,133,134,135,136,138,140,141,147,148,149,151,152,156,157,158,159,161,163,164,168,169,170,179,180,182,183,186,191,193,196],"AIzaSyAP-jjEJBzmIyKR4F-3XITp8yM9T1gEEI8","AIzaSyB6xiKGDR5O3Ak2okS4rLkauxGUG7XP0hg","cloud.google.com","AIzaSyAQk0fBONSGUqCNznf6Krs82Ap1-NV6J4o","AIzaSyCCxcqdrZ_7QMeLCRY20bh_SXdAYqy70KY",null,null,null,["Cloud__enable_cloudx_experiment_ids","Cloud__enable_llm_concierge_chat","Search__enable_suggestions_from_borg","Experiments__reqs_query_experiments","CloudShell__cloud_shell_button","Concierge__enable_concierge_restricted","MiscFeatureFlags__developers_footer_dark_image","Profiles__enable_developer_profiles_callout","MiscFeatureFlags__enable_project_variables","Profiles__enable_dashboard_curated_recommendations","Search__enable_ai_eligibility_checks","MiscFeatureFlags__enable_view_transitions","Search__enable_ai_search_summaries_restricted","Cloud__enable_cloud_shell","Search__enable_ai_search_summaries","Cloud__enable_free_trial_server_call","BookNav__enable_tenant_cache_key","Cloud__enable_cloud_facet_chat","MiscFeatureFlags__enable_firebase_utm","CloudShell__cloud_code_overflow_menu","Profiles__require_profile_eligibility_for_signin","Cloud__enable_legacy_calculator_redirect","Profiles__enable_page_saving","Profiles__enable_complete_playlist_endpoint","MiscFeatureFlags__enable_explain_this_code","MiscFeatureFlags__developers_footer_image","MiscFeatureFlags__emergency_css","Profiles__enable_public_developer_profiles","Analytics__enable_clearcut_logging","Profiles__enable_recognition_badges","TpcFeatures__enable_required_headers","DevPro__enable_cloud_innovators_plus","Profiles__enable_awarding_url","Profiles__enable_completecodelab_endpoint","Concierge__enable_pushui","Search__scope_to_project_tenant","Cloud__enable_cloud_dlp_service","Profiles__enable_release_notes_notifications","TpcFeatures__enable_mirror_tenant_redirects","DevPro__enable_developer_subscriptions","Search__enable_dynamic_content_confidential_banner","EngEduTelemetry__enable_engedu_telemetry","Cloud__enable_cloudx_ping","Profiles__enable_profile_collections","MiscFeatureFlags__enable_variable_operator","Cloud__enable_cloud_shell_fte_user_flow","Search__enable_page_map"],null,null,"AIzaSyBLEMok-5suZ67qRPzx0qUtbnLmyT_kCVE","https://developerscontentserving-pa.clients6.google.com","AIzaSyCM4QpTRSqP5qI4Dvjt4OAScIN8sOUlO-k","https://developerscontentsearch-pa.clients6.google.com",1,4,1,"https://developerprofiles-pa.clients6.google.com",[2,"cloud","Google Cloud","cloud.google.com",null,"cloud-dot-devsite-v2-prod.appspot.com",null,null,[1,1,null,null,null,null,null,null,null,null,null,[1],null,null,null,null,null,1,[1],[null,null,null,[1,20],"/terms/recommendations"],[1],null,[1],[1,null,1],[1,1,null,null,1,null,["/vertex-ai/"]]],null,[22,null,null,null,null,null,"/images/cloud-logo.svg","/images/favicons/onecloud/apple-icon.png",null,null,null,null,1,1,1,[6,5],[],null,null,[[],[],[],[],[],[],[],[]],null,1,null,null,null,null,[]],[],null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[6,1,14,15,22,23,29,37],null,[[null,null,null,null,null,null,[1,[["docType","Choose a content type",[["ApiReference",null,null,null,null,null,null,null,null,"API reference"],["Sample",null,null,null,null,null,null,null,null,"Code sample"],["ReferenceArchitecture",null,null,null,null,null,null,null,null,"Reference architecture"],["Tutorial",null,null,null,null,null,null,null,null,"Tutorial"]]],["category","Choose a topic",[["AiAndMachineLearning",null,null,null,null,null,null,null,null,"Artificial intelligence and machine learning (AI/ML)"],["ApplicationDevelopment",null,null,null,null,null,null,null,null,"Application development"],["BigDataAndAnalytics",null,null,null,null,null,null,null,null,"Big data and analytics"],["Compute",null,null,null,null,null,null,null,null,"Compute"],["Containers",null,null,null,null,null,null,null,null,"Containers"],["Databases",null,null,null,null,null,null,null,null,"Databases"],["HybridCloud",null,null,null,null,null,null,null,null,"Hybrid and multicloud"],["LoggingAndMonitoring",null,null,null,null,null,null,null,null,"Logging and monitoring"],["Migrations",null,null,null,null,null,null,null,null,"Migrations"],["Networking",null,null,null,null,null,null,null,null,"Networking"],["SecurityAndCompliance",null,null,null,null,null,null,null,null,"Security and compliance"],["Serverless",null,null,null,null,null,null,null,null,"Serverless"],["Storage",null,null,null,null,null,null,null,null,"Storage"]]]]]],[1],null,1],[[null,null,null,null,null,["GTM-5CVQBG"],null,null,null,null,null,[["GTM-5CVQBG",2]],1],null,null,null,null,null,1],"mwETRvWii0eU5NUYprb0Y9z5GVbc",4,null,null,null,null,null,null,null,null,null,null,null,null,null,"cloud.devsite.google"],null,"pk_live_5170syrHvgGVmSx9sBrnWtA5luvk9BwnVcvIi7HizpwauFG96WedXsuXh790rtij9AmGllqPtMLfhe2RSwD6Pn38V00uBCydV4m"]') </script> <devsite-a11y-announce></devsite-a11y-announce> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10