This document describes the steps to create standalone A3 Ultra VMs that are deployed on Hypercompute Cluster. For more information about Hypercompute Cluster, see Hypercompute Cluster.
Before you begin
-
Select the tab for how you plan to use the samples on this page:
gcloud
In the Google Cloud console, activate Cloud Shell.
At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.
REST
To use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.
Install the Google Cloud CLI, then initialize it by running the following command:
gcloud init
For more information, see Authenticate for using REST in the Google Cloud authentication documentation.
Required roles
To get the permissions that you need to create VMs,
ask your administrator to grant you the
Compute Instance Admin (v1) (roles/compute.instanceAdmin.v1
) IAM role on the project.
For more information about granting roles, see Manage access to projects, folders, and organizations.
This predefined role contains the permissions required to create VMs. To see the exact permissions that are required, expand the Required permissions section:
Required permissions
The following permissions are required to create VMs:
-
compute.instances.create
on the project -
To use a custom image to create the VM:
compute.images.useReadOnly
on the image -
To use a snapshot to create the VM:
compute.snapshots.useReadOnly
on the snapshot -
To use an instance template to create the VM:
compute.instanceTemplates.useReadOnly
on the instance template -
To assign a legacy network to the VM:
compute.networks.use
on the project -
To specify a static IP address for the VM:
compute.addresses.use
on the project -
To assign an external IP address to the VM when using a legacy network:
compute.networks.useExternalIp
on the project -
To specify a subnet for your VM:
compute.subnetworks.use
on the project or on the chosen subnet -
To assign an external IP address to the VM when using a VPC network:
compute.subnetworks.useExternalIp
on the project or on the chosen subnet -
To set VM instance metadata for the VM:
compute.instances.setMetadata
on the project -
To set tags for the VM:
compute.instances.setTags
on the VM -
To set labels for the VM:
compute.instances.setLabels
on the VM -
To set a service account for the VM to use:
compute.instances.setServiceAccount
on the VM -
To create a new disk for the VM:
compute.disks.create
on the project -
To attach an existing disk in read-only or read-write mode:
compute.disks.use
on the disk -
To attach an existing disk in read-only mode:
compute.disks.useReadOnly
on the disk
You might also be able to get these permissions with custom roles or other predefined roles.
Prerequisites
Before creating VMs, complete the following steps if you haven't already:Create a reservation: to have the necessary resources for your VMs, you first need to reserve blocks of resources.
For instructions, see Request capacity.
Optional: Create a placement policy: to place your VMs in a single block or sub-block and minimize network latency, you can optionally use a compact placement policy. This is useful for workloads that require fast communication among VMs. However, if you need to place your VMs on a specific block to meet particular hardware or network requirements, skip this step and specify the block name when you create the instance template.
For instructions, see Create a compact placement policy.
Create a regional instance template: to specify the VM configuration, including whether to create your VMs in a specific block within the reservation.
For instructions, see Create a regional instance template.
Create VMs
Create each VM by using the instance template created in the prerequisites step.
gcloud
To create the VMs, use the
gcloud beta compute instances create
command.
gcloud beta compute instances create VM_NAME \ --source-instance-template=projects/INSTANCE_TEMPLATE_URL
Replace the following:
VM_NAME
: the name of your VM.PROJECT_ID
: the projectID of your project where the instance template is located.REGION
: the region where the instance template is located.INSTANCE_TEMPLATE_URL
: the URL of the instance template that you created in the prerequisite steps. Specify one of the following values:- For a regional instance template:
projects/PROJECT_ID/regions/REGION/instanceTemplates/INSTANCE_TEMPLATE_NAME
- For a global instance template:
INSTANCE_TEMPLATE_NAME
- For a regional instance template:
REST
To create the VMs, use the
beta instances.insert
method.
POST https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/zones/ZONE/ instances?sourceInstanceTemplate=INSTANCE_TEMPLATE_URL { "name": "VM_NAME" }
Replace the following:
PROJECT_ID
: the projectID of your project where the instance template is located.ZONE
: the zone where the instance template is located.INSTANCE_TEMPLATE_URL
: the URL of the instance template that you created in the prerequisite steps. Specify one of the following values:- For a regional instance template:
projects/PROJECT_ID/regions/REGION/instanceTemplates/INSTANCE_TEMPLATE_NAME
- For a global instance template:
INSTANCE_TEMPLATE_NAME
- For a regional instance template:
VM_NAME
: the name of your VM.