v1
latestSwagger 2.02026-08-04232286653.5 KBVMs
Creates a VM in the project and returns the async operation.
post/projects/{project_id}/compute/vms/instances
Path parameters
project_idstring required
Request body
Example request
{
"disks": [
{
"attachment_type": "data",
"disk_id": "09ae8411-0fbb-411c-898c-2b8f19622ae1",
"mode": "read-write"
}
],
"image": "ubuntu:20.04",
"location": "us-northcentral1-a",
"maintenance_policy": "manual,stop-vm,unspecified",
"name": "my-first-vm",
"network_interfaces": [
{
"id": "ca39e669-47ee-456b-968d-303234fbf99f",
"interface_type": "ethernet",
"ips": [
{
"private_ipv4": {
"address": "10.1.2.3"
},
"public_ipv4": {
"address": "121.0.0.0",
"id": "1ce839b7-3fab-46f9-8e54-7a6bb4ac1ffc",
"type": "dynamic"
}
}
],
"mac_address": "00:00:5e:00:53:af",
"name": "network-interface-1",
"network": "1ce839b7-3fab-46f9-8e54-7a6bb4ac1ffc",
"subnet": "1ce839b7-3fab-46f9-8e54-7a6bb4ac1ffc"
}
],
"reservation_specification": {
"id": "804bf3a2-81f2-4d78-9a9e-dc6a55ed33d8",
"selection_strategy": "lowest_cost"
},
"shutdown_script": "#!/bin/bash\\necho 'goodbye'",
"ssh_public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCspdG97nTS/h4PEPq2QD2RYVK1jxFXLFZuSDMI8Rtxpucl6LDZLOghEYoj13lxKQnGtcsM3Iu68lh+4YgZe7CbI6cc/TxPbeAX2HJTqDh0J7+GAlLBHK9tsepC0QlhIDiazJptOPDZ3cesCBXdxSnzEbhDaqgYOfl393cp1fCeOKRIDWEP3H9CM25dCbWF66sTDziLsojJ9dMnxhgKm9/JkZc5gYncLT/2Ey+VWfV9Fs65mGUrBbQOn3c8S/nEk6WRcYn4PFOnIp0Mz+Chb50iCJrW677pllLnkTGSU+4c0H9J5z4HDG0I+91RoiQ0QsayFTYO1JtSn+THLuq98V+D",
"startup_script": "#!/bin/bash\\necho 'hello'",
"type": "a100.2x",
"virtualization_features": {
"nested_virtualization": true
}
}Response
Example response
{
"operation": {
"completed_at": "2021-12-03T19:59:34Z",
"metadata": "{}",
"operation_id": "F6EF489C-086E-458D-B812-7962964A28C9",
"result": "{}",
"started_at": "2021-12-03T19:58:34Z",
"state": "IN_PROGRESS"
}
}