You can create a Confidential VM instance as part of creating a new Compute Engine virtual machine.
Before you begin
Before creating a Confidential VM instance, you need to set up your environment as follows:
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Compute Engine API.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Compute Engine API.
- Optional: To use the gcloud CLI examples in this guide:
- Install or update to the latest version of the gcloud CLI.
- Set a default region and zone for your client that supports Confidential VM.
- Optional: To use the API examples in this guide, set up authentication for your requests. Learn more about OAuth 2.0.
Create an instance
Console
To create an AMD SEV Confidential VM with the Google Cloud console, complete the following steps.
In the Google Cloud console, go to the VM instances page.
Click Create instance.
In the Confidential VM service section, click Enable.
In the Enable Confidential Computing dialog, review the list of settings that are updated when you enable the service. They can include the following fields, if they were set to incompatible values.
Series and Machine type. For more information, see Machine types, CPUs, and zones.
Region and zone. For more information, see Machine types, CPUs, and zones.
Boot disk image. For more information, see Operating systems.
On-host maintenance. For more information, see Set host maintenance policy of a VM.
Network interface card. For more information, see Using Google Virtual NIC.
Click Enable.
In the Machine configuration section, expand Advanced configurations.
For the CPU platform, choose AMD Milan or later.
Verify that you are satisfied with these settings, and then click Create.
After you click Create, the VM instances page opens. On this page you can view the status and details for your new instance. When an Available icon appears in the Status column for your Confidential VM instance, it's ready to use.
gcloud
AMD SEV
To create an AMD SEV Confidential VM instance with the gcloud CLI
on C2D, N2D, and C3D machine types, use the instances create
sub-command with the --confidential-compute-type
flag.
gcloud compute instances create INSTANCE_NAME \
--machine-type=MACHINE_TYPE \
--min-cpu-platform="CPU_PLATFORM" \
--zone=ZONE_NAME \
--confidential-compute-type=SEV \
--image-family=IMAGE_FAMILY_NAME \
--image-project=IMAGE_PROJECT \
--project=PROJECT_ID
Provide the following values:
INSTANCE_NAME
: The name of the new VM instance.MACHINE_TYPE
: The VM machine type—for example,n2d-standard-2
. Must be an N2D, C2D, or C3D machine type. Only N2D supports live migration—if you choose a C2D or C3D machine type, you must add the--maintenance-policy=TERMINATE
flag.CPU_PLATFORM
: EitherAMD Milan
(C2D or N2D) orAMD Genoa
(C3D).ZONE_NAME
: The Confidential VM-supported zone in which to create the instance.IMAGE_FAMILY_NAME
: The family for the Confidential VM-supported operating system image. When you don't additionally specify--image
, the latest image version is selected.IMAGE_PROJECT
: The project containing the supported operating system image.PROJECT_ID
: Optional. The ID of the project to create the VM in.
Example
Run the following command to create an n2d-standard-2
instance called
my-instance
in the us-central1-a
zone:
gcloud compute instances create my-instance \
--machine-type=n2d-standard-2 \
--min-cpu-platform="AMD Milan" \
--zone=us-central1-a \
--confidential-compute-type=SEV \
--image-family=ubuntu-2404-lts-amd64 \
--image-project=ubuntu-os-cloud
AMD SEV-SNP
To create an AMD SEV-SNP Confidential VM instance with the
gcloud CLI, use the instances create
sub-command with the --confidential-compute-type
flag.
gcloud compute instances create INSTANCE_NAME \
--machine-type=MACHINE_TYPE \
--min-cpu-platform="AMD Milan" \
--zone=ZONE_NAME \
--confidential-compute-type=SEV_SNP \
--maintenance-policy=TERMINATE \
--image-family=IMAGE_FAMILY_NAME \
--image-project=IMAGE_PROJECT \
--project=PROJECT_ID
You must set the --maintenance-policy
flag to TERMINATE
because
SEV-SNP VM instances don't support live migration.
Provide the following values:
INSTANCE_NAME
: The name of the new VM instance.MACHINE_TYPE
: The VM machine type—for example,n2d-standard-2
. AMD SEV-SNP machines must be an N2D machine type.ZONE_NAME
: The Confidential VM-supported zone in which to create the instance.IMAGE_FAMILY_NAME
: The family for the Confidential VM-supported operating system image. When you don't additionally specify--image
, the latest image version is selected.IMAGE_PROJECT
: The project containing the supported operating system image.PROJECT_ID
: Optional. The ID of the project to create the VM in.
Example
Run the following command to create an n2d-standard-2
instance called
my-instance
in the us-central1-a
zone:
gcloud compute instances create my-instance \
--machine-type=n2d-standard-2 \
--min-cpu-platform="AMD Milan" \
--zone=us-central1-a \
--confidential-compute-type=SEV_SNP \
--maintenance-policy=TERMINATE \
--image-family=ubuntu-2404-lts-amd64 \
--image-project=ubuntu-os-cloud
Intel TDX
To create an Intel TDX Confidential VM instance with the
gcloud CLI, use the
instances create
sub-command with the --confidential-compute-type
flag.
gcloud compute instances create INSTANCE_NAME \
--machine-type=MACHINE_TYPE \
--zone=ZONE_NAME \
--confidential-compute-type=TDX \
--maintenance-policy=TERMINATE \
--image-family=IMAGE_FAMILY_NAME \
--image-project=IMAGE_PROJECT \
--project=PROJECT_ID
You must set the --maintenance-policy
flag to TERMINATE
because
Intel TDX VM instances don't support
live migration.
Provide the following values:
INSTANCE_NAME
: The name of the new VM instance.MACHINE_TYPE
: The VM machine type — for example,c3-standard-4
. Intel TDX machines must be ac3-standard-*
machine type.ZONE_NAME
: The Confidential VM-supported zone in which to create the instance.IMAGE_FAMILY_NAME
: The family for the Confidential VM-supported operating system image. When you don't additionally specify--image
, the latest image version is selected.IMAGE_PROJECT
: The project containing the supported operating system image.PROJECT_ID
: Optional. The ID of the project to create the VM in.
Example
Run the following command to create an c3-standard-4
instance called
my-instance
in the us-central1-a
zone:
gcloud compute instances create my-instance \
--machine-type=c3-standard-4 \
--zone=us-central1-a \
--confidential-compute-type=TDX \
--maintenance-policy=TERMINATE \
--image-family=ubuntu-2404-lts-amd64 \
--image-project=tdx-guest-images
REST
AMD SEV
To create an AMD SEV Confidential VM instance, you need to send a POST request with the appropriate body content.
The HTTP method and URL:
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE_NAME/instances
Request JSON body:
{
"machineType": "zones/ZONE_NAME/machineTypes/MACHINE_TYPE",
"name": "INSTANCE_NAME",
"minCpuPlatform": "CPU_PLATFORM",
"confidentialInstanceConfig": {
"confidentialInstanceType": "SEV"
},
"disks": [
{
"boot": true,
"initializeParams": {
"sourceImage": "projects/IMAGE_PROJECT/global/images/family/IMAGE_FAMILY_NAME"
}
}
],
"networkInterfaces": [
{
"nicType": "gVNIC"
}
],
"scheduling": {
"automaticRestart": true,
"nodeAffinities": [],
"preemptible": false
}
}
Provide the following values:
PROJECT_ID
: The ID of the project to create the VM in.ZONE_NAME
: The Confidential VM-supported zone in which to create the instance.MACHINE_TYPE
: The VM machine type—for example,n2d-standard-2
. Must be an N2D, C2D, or C3D machine type. Only N2D supports live migration—if you choose a C2D or C3D machine type, you must add the--maintenance-policy=TERMINATE
flag.INSTANCE_NAME
: The name of new VM instance.CPU_PLATFORM
: Optional. EitherAMD Milan
(C2D or N2D) orAMD Genoa
(C3D).IMAGE_FAMILY_NAME
: The family for the Confidential VM-supported operating system image. When you don't additionally specify--image
, the latest image version is selected.IMAGE_PROJECT
: The project containing the supported operating system image.
AMD SEV-SNP
To create an AMD SEV-SNP Confidential VM instance, you need to send a POST request with the appropriate body content.
HTTP method and URL:
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE_NAME/instances
Request JSON body:
{
"machineType": "zones/ZONE_NAME/machineTypes/MACHINE_TYPE",
"name": "INSTANCE_NAME",
"minCpuPlatform": "AMD Milan",
"confidentialInstanceConfig": {
"confidentialInstanceType": "SEV_SNP"
},
"disks": [
{
"boot": true,
"initializeParams": {
"sourceImage": "projects/IMAGE_PROJECT/global/images/family/IMAGE_FAMILY_NAME"
}
}
],
"networkInterfaces": [
{
"nicType": "gVNIC"
}
],
"scheduling": {
"automaticRestart": true,
"nodeAffinities": [],
"onHostMaintenance": "TERMINATE",
"preemptible": false
}
}
You must set onHostMaintenance
to TERMINATE
because AMD SEV-SNP VM
instances don't support live migration.
Provide the following values:
PROJECT_ID
: The ID of the project to create the VM in.ZONE_NAME
: The Confidential VM-supported zone in which to create the instance.MACHINE_TYPE
: The VM machine type—for example,n2d-standard-2
. AMD SEV-SNP machines must be an N2D machine type.INSTANCE_NAME
: The name of new VM instance.IMAGE_FAMILY_NAME
: The family for the Confidential VM-supported operating system image. When you don't additionally specify--image
, the latest image version is selected.IMAGE_PROJECT
: The project containing the supported operating system image.
Intel TDX
To create an Intel TDX Confidential VM instance, you need to send a POST request with the appropriate body content.
HTTP method and URL:
POST https://compute.googleapis.com/compute/projects/PROJECT_ID/zones/ZONE_NAME/instances
Request JSON body:
{
"machineType": "zones/ZONE_NAME/machineTypes/MACHINE_TYPE",
"name": "INSTANCE_NAME",
"confidentialInstanceConfig": {
"confidentialInstanceType": "TDX"
},
"disks": [
{
"boot": true,
"initializeParams": {
"sourceImage": "projects/IMAGE_PROJECT/global/images/family/IMAGE_FAMILY_NAME"
}
}
],
"networkInterfaces": [
{
"nicType": "gVNIC"
}
],
"scheduling": {
"automaticRestart": true,
"nodeAffinities": [],
"onHostMaintenance": "TERMINATE",
"preemptible": false
}
}
You must set onHostMaintenance
to TERMINATE
because Intel TDX VM
instances don't support
live migration.
Provide the following values:
PROJECT_ID
: The ID of the project to create the VM in.ZONE_NAME
: The Confidential VM-supported zone in which to create the instance.MACHINE_TYPE
: The VM machine type—for example,c3-standard-4
. Intel TDX machines must be ac3-standard-*
machine type.INSTANCE_NAME
: The name of new VM instance.IMAGE_FAMILY_NAME
: The family for the Confidential VM-supported operating system image. When you don't additionally specify--image
, the latest image version is selected.
Example
Run one of the following commands to create an n2d-standard-2
instance
called my-instance
in the us-central1-a
zone, in the my-project
project:
AMD SEV
curl (Linux, macOS, or Cloud Shell)
curl -X POST \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ -d '{ "machineType": "zones/us-central1-a/machineTypes/n2d-standard-2", "name": "my-instance", "minCpuPlatform": "AMD Milan", "confidentialInstanceConfig": { "confidentialInstanceType": "SEV" }, "disks": [ { "boot": true, "initializeParams": { "sourceImage": "projects/ubuntu-os-cloud/global/images/family/ubuntu-2404-lts-amd64" } } ], "networkInterfaces": [ { "nicType": "gVNIC" } ], "scheduling": { "automaticRestart": true, "nodeAffinities": [], "preemptible": false } }' \ https://compute.googleapis.com/compute/v1/projects/my-project/zones/us-central1-a/instances
PowerShell (Windows)
$cred = gcloud auth print-access-token $headers = @{ "Authorization" = "Bearer $cred" } $body = @" { "machineType": "zones/us-central1-a/machineTypes/n2d-standard-2", "name": "my-instance", "minCpuPlatform": "AMD Milan", "confidentialInstanceConfig": { "confidentialInstanceType": "SEV" }, "disks": [ { "boot": true, "initializeParams": { "sourceImage": "projects/ubuntu-os-cloud/global/images/family/ubuntu-2404-lts-amd64" } } ], "networkInterfaces": [ { "nicType": "gVNIC" } ], "scheduling": { "automaticRestart": true, "nodeAffinities": [], "preemptible": false } } "@ Invoke-WebRequest ` -Method POST ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Body $body ` -Uri "https://compute.googleapis.com/compute/v1/projects/my-project/zones/us-central1-a/instances" | Select-Object -Expand Content
AMD SEV-SNP
curl (Linux, macOS, or Cloud Shell)
curl -X POST \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ -d '{ "machineType": "zones/us-central1-a/machineTypes/n2d-standard-2", "name": "my-instance", "minCpuPlatform": "AMD Milan", "confidentialInstanceConfig": { "confidentialInstanceType": "SEV_SNP" }, "disks": [ { "boot": true, "initializeParams": { "sourceImage": "projects/ubuntu-os-cloud/global/images/family/ubuntu-2404-lts-amd64" } } ], "networkInterfaces": [ { "nicType": "gVNIC" } ], "scheduling": { "automaticRestart": true, "nodeAffinities": [], "onHostMaintenance": "TERMINATE", "preemptible": false } }' \ https://compute.googleapis.com/compute/v1/projects/my-project/zones/us-central1-a/instances
PowerShell (Windows)
$cred = gcloud auth print-access-token $headers = @{ "Authorization" = "Bearer $cred" } $body = @" { "machineType": "zones/us-central1-a/machineTypes/n2d-standard-2", "name": "my-instance", "minCpuPlatform": "AMD Milan", "confidentialInstanceConfig": { "confidentialInstanceType": "SEV_SNP" }, "disks": [ { "boot": true, "initializeParams": { "sourceImage": "projects/ubuntu-os-cloud/global/images/family/ubuntu-2404-lts-amd64" } } ], "networkInterfaces": [ { "nicType": "gVNIC" } ], "scheduling": { "automaticRestart": true, "nodeAffinities": [], "onHostMaintenance": "TERMINATE", "preemptible": false } } "@ Invoke-WebRequest ` -Method POST ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Body $body ` -Uri "https://compute.googleapis.com/compute/projects/my-project/zones/us-central1-a/instances" | Select-Object -Expand Content
Intel TDX
curl (Linux, macOS, or Cloud Shell)
curl -X POST \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ -d '{ "machineType": "zones/us-central1-a/machineTypes/c3-standard-4", "name": "my-instance", "confidentialInstanceConfig": { "confidentialInstanceType": "TDX" }, "disks": [ { "boot": true, "initializeParams": { "sourceImage": "projects/tdx-guest-images/global/images/family/ubuntu-2404-lts-amd64" } } ], "networkInterfaces": [ { "nicType": "gVNIC" } ], "scheduling": { "automaticRestart": true, "nodeAffinities": [], "onHostMaintenance": "TERMINATE", "preemptible": false } }' \ https://compute.googleapis.com/compute/projects/my-project/zones/us-central1-a/instances
PowerShell (Windows)
$cred = gcloud auth print-access-token $headers = @{ "Authorization" = "Bearer $cred" } $body = @" { "machineType": "zones/us-central1-a/machineTypes/c3-standard-4", "name": "my-instance", "confidentialInstanceConfig": { "confidentialInstanceType": "TDX" }, "disks": [ { "boot": true, "initializeParams": { "sourceImage": "projects/tdx-guest-images/global/images/family/ubuntu-2404-lts-amd64" } } ], "networkInterfaces": [ { "nicType": "gVNIC" } ], "scheduling": { "automaticRestart": true, "nodeAffinities": [], "onHostMaintenance": "TERMINATE", "preemptible": false } } "@ Invoke-WebRequest ` -Method POST ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -Body $body ` -Uri "https://compute.googleapis.com/compute/projects/my-project/zones/us-central1-a/instances" | Select-Object -Expand Content
Response
A response to a creation request looks similar to the following example:
{
"kind": "compute#operation",
"id": "REQUEST_ID",
"name": "OPERATION_ID",
"zone": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE_NAME",
"operationType": "insert",
"targetLink": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE_NAME/instances/INSTANCE_NAME",
"targetId": "TARGET_ID",
"status": "RUNNING",
"user": "USERNAME",
"progress": 0,
"insertTime": "2023-08-01T16:35:15.144-07:00",
"startTime": "2023-08-01T16:35:15.144-07:00",
"selfLink": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE_NAME/operations/OPERATION_ID"
}
You can check the VM creation progress by making a GET
request to the
selfLink
:
GET https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE_NAME/operations/OPERATION_ID
Enable higher network bandwidth for C2D machine types
The three largest C2D Compute Engine VM shapes (32, 56, and 112) support high-bandwidth networking. When you select a Tier 1 network bandwidth configuration, the data transfer out bandwidth increases from the default 32 Gbps to 50 or 100 Gbps. To achieve the higher Tier 1 bandwidth speeds, the instance must be running the gVNIC virtual network driver. Learn more about configuring a VM with higher bandwidth.
What's next
Learn how to use Cloud Monitoring to validate your Confidential VM instances.