Create a reservation for a single project


This document explains how to create a single-project reservation, which can be consumed only by virtual machine (VM) instances in the same project. To learn more about reservations, see Reservations of Compute Engine zonal resources.

For other methods of creating reservations, see instead the following pages:

  • If you have any 1-year or 3-years commitments in the current project, then your reserved resources automatically receive any applicable committed use discounts. You can also create and attach a reservation to a commitment when you purchase the commitment. To learn more, see Attach reservations to commitments.

  • To create a reservation that can be used by multiple projects, see Create a shared reservation.

Before you begin

  • Review the requirements and restrictions for reservations.
  • If you haven't already, set up authentication. Authentication 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 as follows.

    Select the tab for how you plan to use the samples on this page:

    Console

    When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.

    gcloud

    1. Install the Google Cloud CLI, then initialize it by running the following command:

      gcloud init
    2. Set a default region and zone.

    Terraform

    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.

    1. Install the Google Cloud CLI.
    2. To initialize the gcloud CLI, run the following command:

      gcloud init
    3. Create local authentication credentials for your Google Account:

      gcloud auth application-default login

    For more information, see Set up authentication for a local development environment.

    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 single-project reservations, ask your administrator to grant you the Compute Admin (roles/compute.admin) IAM role on the project. For more information about granting roles, see Manage access.

This predefined role contains the permissions required to create single-project reservations. To see the exact permissions that are required, expand the Required permissions section:

Required permissions

The following permissions are required to create single-project reservations:

  • compute.reservations.create on the project
  • To specify an instance template: compute.instanceTemplates.useReadOnly on the instance template

You might also be able to get these permissions with custom roles or other predefined roles.

Create a single-project reservation

This section explains how to create single-project reservations.

To consume a reservation, a VM must have properties that exactly match that reservation. To specify the properties of the VMs that you want to reserve, select one of the following sections in this document:

By default, a reservation can be automatically consumed by any VMs with properties that match it. If you want to control reservation consumption, do one or more of the following:

Additionally, you can specify a compact placement policy when creating a single-project reservation. A compact placement policy specifies that VMs are to be located as close to each other as possible to reduce network latency.

Specify an instance template

To avoid errors when creating a reservation by specifying an instance template, make sure of the following:

  • Create your reservation in the same region and zone as the resources within the instance template. Any regional or zonal resources specified in an instance template—such as a machine type or a Persistent Disk volume—restrict the use of the template to the locations where those resources exist. For example, if your instance template specifies an existing Persistent Disk volume in zone us-central1-a, then you can only create your reservation in the same zone. To check if an existing template specifies any resources that bind the template to a specific region or zone, view the details of the instance template and look for references to regional or zonal resources inside of it.

  • If the instance template specifies a compact placement policy, then make sure that the template specifies a supported machine type for compact placement policies. Otherwise, creating the reservation fails.

To create a single-project reservation by specifying an instance template, select one of the following options:

Console

  1. In the Google Cloud console, go to the Reservations page.

    Go to Reservations

  2. Click Create reservation.

    The Create a reservation page opens.

  3. In the Name field, enter a name for your reservation.

  4. Select the Region and Zone where you want to reserve resources.

  5. In the Share type section, click Local (default).

  6. In the Use with VM instance section, select one of the following options:

    • To allow matching VMs to automatically consume this reservation, select Use reservation automatically (default).

    • To consume this reservation's resources only when creating matching VMs that specifically target this reservation by name, select Select specific reservation.

  7. In the Number of VM instances field, enter the number of VMs that you want to reserve.

  8. In the Machine configuration section, do the following:

    1. To specify the properties of your VMs from an existing instance template, select Use instance template.

    2. In the Instance template field, select the instance template of your choice. If you select a regional instance template, then you can only reserve resources within the region of the instance template.

  9. In the Auto-delete section, you can enable the auto-delete option to let Compute Engine automatically delete the reservation at a specific date and time. Automatically deleting reservations can be useful to avoid unnecessary charges when you stop consuming the reservation.

  10. To create the reservation, click Create.

    The Reservations page opens. Creating the single-project reservation might take up to a minute to complete.

gcloud

To create a single-project reservation, use the gcloud compute reservations create command.

To create a single-project reservation by specifying an instance template and without including any optional flags, run the following command:

gcloud compute reservations create RESERVATION_NAME \
    --project=PROJECT_ID \
    --source-instance-template=projects/PROJECT_ID/LOCATION/instanceTemplates/INSTANCE_TEMPLATE_NAME \
    --vm-count=NUMBER_OF_VMS \
    --zone=ZONE

Replace the following:

  • RESERVATION_NAME: the name of the reservation to create.

  • PROJECT_ID: the ID of the project where you want to reserve resources and where the instance template exists.

  • LOCATION: the location of the instance template. Specify one of the following values:

    • For a global instance template: global.

    • For a regional instance template: regions/REGION. Replace REGION with the region where the instance template is located. If you specify a regional instance template, you can only reserve VMs within the region of the instance template.

  • INSTANCE_TEMPLATE_NAME: the name of an existing instance template. If the instance template specifies an A3 machine type or a compact placement policy, then you must include the --require-specific-reservation flag. This indicates that only VMs that specifically target the reservation can consume it. For more information, see Consume VMs from a specific reservation.

  • NUMBER_OF_VMS: the number of VMs to reserve.

  • ZONE: the zone in which to reserve resources.

For example, to create a reservation for ten VMs in zone us-central1-a by specifying a global instance template, run the following command:

gcloud compute reservations create my-reservation \
    --project=example-project \
    --source-instance-template=projects/example-project/global/example-instance-template \
    --vm-count=10 \
    --zone=us-central1-a

Optionally, you can do one or more of the following:

  • To specify that only VMs that specifically target this reservation can consume it, include the --require-specific-reservation flag.

    gcloud compute reservations create example-reservation \
        --require-specific-reservation \
        ...
    
  • To enable Compute Engine to automatically delete the reservation, select one of the following methods:

    • To delete the reservation at a specific date and time, use the gcloud beta compute reservations create command and include the --delete-at-time flag.

      gcloud beta compute reservations create reservation-example \
          --delete-at-time=DELETE_AT_TIME \
          ...
      

      Replace DELETE_AT_TIME with a date and time formatted as an RFC 3339 timestamp, which must be as follows: none YYYY-MM-DDTHH:MM:SSOFFSET

      Replace the following:

      • YYYY-MM-DD: a date formatted as a 4-digit year, 2-digit month, and a 2-digit day of the month, separated by hyphens (-).

      • HH:MM:SS: a time formatted as a 2-digit hour using a 24-hour time, 2-digit minutes, and 2-digit seconds, separated by colons (:).

      • OFFSET: the time zone formatted as an offset of Coordinated Universal Time (UTC). For example, to use the Pacific Standard Time (PST), specify -08:00. Alternatively, to use no offset, specify Z.

    • To delete the reservation after a specific duration, use the gcloud beta compute reservations create command and include the --delete-after-duration flag.

      gcloud beta compute reservations create reservation-example \
          --delete-after-duration=DELETE_AFTER_DURATION \
          ...
      

      Replace DELETE_AFTER_DURATION with a duration in days, hours, minutes, or seconds. For example, specify 30m for 30 minutes, or 1d2h3m4s for 1 day, 2 hours, 3 minutes, and 4 seconds.

REST

To create a single-project reservation, make a POST request to the reservations.insert method.

To create a single-project reservation by specifying an instance template and without including any optional flags, make the following POST request:

POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/reservations

{
  "name": "RESERVATION_NAME",
  "specificReservation": {
    "count": "NUMBER_OF_VMS",
    "sourceInstanceTemplate": "projects/PROJECT_ID/LOCATION/instanceTemplates/INSTANCE_TEMPLATE_NAME"
  }
}

Replace the following:

  • PROJECT_ID: the ID of the project where you want to reserve resources and where the instance template exists.

  • ZONE: the zone in which to reserve resources.

  • RESERVATION_NAME: the name of the reservation to create.

  • NUMBER_OF_VMS: the number of VMs to reserve.

  • LOCATION: the location of the instance template. Specify one of the following values:

    • For a global instance template: global.

    • For a regional instance template: regions/REGION. Replace REGION with the region where the instance template is located. If you specify a regional instance template, you can only reserve VMs within the region of the instance template.

  • INSTANCE_TEMPLATE_NAME: the name of an existing instance template. If the instance template specifies an A3 machine type or a compact placement policy, then you must include the specificReservationRequired field in the request body, and set the field to true. This indicates that only VMs that specifically target this reservation can consume it. For more information, see Consume VMs from a specific reservation.

For example, to create a reservation for ten VMs in zone us-central1-a by specifying a global instance template, make the following POST request:

POST https://compute.googleapis.com/compute/v1/projects/example-project/zones/us-central1-a/reservations

{
  "name": "my-reservation",
  "specificReservation": {
    "count": "10",
    "sourceInstanceTemplate": "projects/example-project/global/instanceTemplates/example-instance-template"
  }
}

Optionally, you can do one or more of the following:

  • To specify that only VMs that specifically target this reservation can consume it, include the specificReservationRequired field in the request body, and set the field to true.

    POST https://compute.googleapis.com/compute/v1/projects/example-project/zones/us-central1-a/reservations
    
    {
      "name": "example-reservation",
      "specificReservationRequired": true,
      ...
    }
    
  • To enable Compute Engine to automatically delete the reservation, select one of the following methods:

    • To delete the reservation at a specific date and time, make a POST request to the beta.reservations.insert method. In the request body, include the deleteAtTime field.

      POST https://compute.googleapis.com/compute/beta/projects/example-project/zones/us-central1-a/reservations
      
      {
        "name": "example-reservation",
        "deleteAtTime": "DELETE_AT_TIME",
        ...
      }
      

      Replace DELETE_AT_TIME with a date and time formatted as an RFC 3339 timestamp, which must be as follows:

      YYYY-MM-DDTHH:MM:SSOFFSET
      

      Replace the following:

      • YYYY-MM-DD: a date formatted as a 4-digit year, 2-digit month, and a 2-digit day of the month, separated by hyphens (-).

      • HH:MM:SS: a time formatted as a 2-digit hour using a 24-hour time, 2-digit minutes, and 2-digit seconds, separated by colons (:).

      • OFFSET: the time zone formatted as an offset of Coordinated Universal Time (UTC). For example, to use the Pacific Standard Time (PST), specify -08:00. Alternatively, to use no offset, specify Z.

    • To delete the reservation after a specific duration, make a POST request to the beta.reservations.insert method. In the request body, include the deleteAfterDuration field.

      POST https://compute.googleapis.com/compute/beta/projects/example-project/zones/us-central1-a/reservations
      
      {
        "name": "example-reservation",
        "deleteAfterDuration": {
          "seconds": "DELETE_AFTER_DURATION"
        },
        ...
      }
      

      Replace DELETE_AFTER_DURATION with a duration in seconds. For example, specify 86400 for 86,400 seconds (1 day).

Specify properties directly

To create a single-project reservation by specifying properties directly, select one of the following options:

Console

  1. In the Google Cloud console, go to the Reservations page.

    Go to Reservations

  2. Click Create reservation.

    The Create a reservation page opens.

  3. In the Name field, enter a name for your reservation.

  4. Select the Region and Zone where you want to reserve resources.

  5. In the Share type section, click Local (default).

  6. In the Use with VM instance section, select one of the following options:

    • To allow matching VMs to automatically consume this reservation, select Use reservation automatically (default).

    • To consume this reservation's resources only when creating matching VMs that specifically target this reservation by name, select Select specific reservation.

  7. In the Number of VM instances field, enter the number of VMs that that you want to reserve.

  8. In the Machine configuration section, select Specify machine type, and then specify the following:

    1. In the Machine family, Series, and Machine type fields, select a machine family, series, and machine type.

    2. Optional: To specify a minimum CPU platform or attach GPUs to N1 VMs, do the following:

      1. To expand the CPU Platform and GPU section, click the expander arrow.

      2. Optional: To specify a minimum CPU platform, in the CPU Platform list, select an option.

      3. Optional: To attach GPUs to N1 VMs, click Add GPU. Then, in the GPU type and Number of GPUs fields, select the type and number of GPUs to attach to each N1 VM.

    3. Optional: To add Local SSD disks, do the following:

      1. In the Number of disks field, select the number of Local SSD disks for each VM.

      2. In the Interface type field, select the interface for the Local SSD disks.

    4. Optional: To specify a compact placement policy for a reservation that meets the requirements, click the Select or create a group placement policy list, and then do one of the following:

      • To create a compact placement policy to specify in this reservation, follow these steps:

        1. Click Create group placement policy.

          The Create a group placement policy pane appears.

        2. In the Policy name field, enter a name for your policy.

        3. Click Create.

          Creating the compact placement policy might take a few seconds to complete.

      • Otherwise, select an existing compact placement policy.

  9. In the Auto-delete section, you can enable the auto-delete option to let Compute Engine automatically delete the reservation at a specific date and time. Automatically deleting reservations can be useful to avoid unnecessary charges when you stop consuming the reservation.

  10. To create the reservation, click Create.

    Creating the single-project reservation might take some time to complete. This action redirects you to the Reservations page.

gcloud

To create a single-project reservation, use the gcloud compute reservations create command.

To create a single-project reservation by specifying properties directly and without including any optional flags, run the following command:

gcloud compute reservations create RESERVATION_NAME \
    --machine-type=MACHINE_TYPE \
    --project=PROJECT_ID \
    --vm-count=NUMBER_OF_VMS \
    --zone=ZONE

Replace the following:

  • RESERVATION_NAME: the name of the reservation to create.

  • MACHINE_TYPE: a machine type to use for each VM. If you specify an A3 machine type, then you must include the --require-specific-reservation flag. This indicates that only VMs that specifically target the reservation can consume it. For more information, see Consume VMs from a specific reservation.

  • PROJECT_ID: the ID of the project where you want to reserve resources.

  • NUMBER_OF_VMS: the number of VMs to reserve.

  • ZONE: the zone in which to reserve resources.

For example, to create a reservation in zone us-central1-a for ten VMs that each use an N2 predefined machine type with 4 vCPUs, run the following command:

gcloud compute reservations create my-reservation \
    --machine-type=n2-standard-4 \
    --project=example-project \
    --vm-count=10 \
    --zone=us-central1-a

Optionally, you can do one or more of the following:

  • To attach GPUs to your reserved N1 VMs, include the --accelerator flag.

    gcloud compute reservations create my-reservation \
        --accelerator=count=NUMBER_OF_ACCELERATORS,type=ACCELERATOR_TYPE
        ...
    

    Replace the following:

  • To add one or more Local SSD disks to each reserved VM, include one or more --local-ssd flags. You can specify up to 24 Local SSD disks. Each Local SSD disk is 375 GB.

    For example, to specify two Local SSD disks when creating a reservation, include two --local-ssd flags as follows:

    gcloud compute reservations create my-reservation \
        --local-ssd=size=375,interface=INTERFACE_1 \
        --local-ssd=size=375,interface=INTERFACE_2 \
        ...
    

    Replace INTERFACE_1 and INTERFACE_2 with the type of interface you want the Local SSD disk to use. Specify one of the following values:

    • NVME disk interfaces: nvme

    • SCSI disk interfaces: scsi

    Make sure that the machine type you specify for the reserved VMs supports the chosen disk interfaces. Otherwise, creating the reservation fails. For more information, see how to choose a disk interface.

  • To have the reserved VMs use a specific minimum CPU platform instead of the zone's default CPU platform, include the --min-cpu-platform flag.

    gcloud compute reservations create my-reservation \
        --min-cpu-platform="MIN_CPU_PLATFORM" \
        ...
    

    Replace MIN_CPU_PLATFORM with a minimum CPU platform. To make sure that a CPU platform is available in the zone where you're reserving resources, view the available CPU platforms by zone.

  • To specify that only VMs that specifically target this reservation can consume it, include the --require-specific-reservation flag.

    gcloud compute reservations create example-reservation \
        --require-specific-reservation \
        ...
    
  • To specify a compact placement policy for lower network latency among VMs, include the --resource-policies=policy flag.

    gcloud compute reservations create example-reservation \
        --resource-policies=policy=COMPACT_PLACEMENT_POLICY_NAME \
        --require-specific-reservation \
        ...
    

    Replace COMPACT_PLACEMENT_POLICY_NAME with the name of an existing compact placement policy. Additionally, to avoid errors when creating a single-project reservation that specifies a compact placement policy, make sure to specify the following:

    • A supported machine type and maximum number of VMs for compact placement policies.

    • A zone within the region where the compact placement policy is located.

    • The --require-specific-reservation flag. This indicates that only VMs that specifically target the reservation can consume it.

  • To enable Compute Engine to automatically delete the reservation, select one of the following methods:

    • To delete the reservation at a specific date and time, use the gcloud beta compute reservations create command and include the --delete-at-time flag.

      gcloud beta compute reservations create reservation-example \
          --delete-at-time=DELETE_AT_TIME \
          ...
      

      Replace DELETE_AT_TIME with a date and time formatted as an RFC 3339 timestamp, which must be as follows:

      YYYY-MM-DDTHH:MM:SSOFFSET
      

      Replace the following:

      • YYYY-MM-DD: a date formatted as a 4-digit year, 2-digit month, and a 2-digit day of the month, separated by hyphens (-).

      • HH:MM:SS: a time formatted as a 2-digit hour using a 24-hour time, 2-digit minutes, and 2-digit seconds, separated by colons (:).

      • OFFSET: the time zone formatted as an offset of Coordinated Universal Time (UTC). For example, to use the Pacific Standard Time (PST), specify -08:00. Alternatively, to use no offset, specify Z.

    • To delete the reservation after a specific duration, use the gcloud beta compute reservations create command and include the --delete-after-duration flag.

      gcloud beta compute reservations create reservation-example \
          --delete-after-duration=DELETE_AFTER_DURATION \
          ...
      

      Replace DELETE_AFTER_DURATION with a duration in days, hours, minutes, or seconds. For example, specify 30m for 30 minutes, or 1d2h3m4s for 1 day, 2 hours, 3 minutes, and 4 seconds.

Terraform

To create a single-project reservation, use the google_compute_reservation Terraform resource.

For example, to create a single-project reservation for one N2 predefined machine type with 2 vCPUs, use the following resource:


resource "google_compute_reservation" "default" {
  name = "gce-reservation-local"
  zone = "us-central1-a"

  /**
   * To specify a single-project reservation, omit the share_settings block
   * (default) or set the share_type field to LOCAL.
   */
  share_settings {
    share_type = "LOCAL"
  }

  specific_reservation {
    count = 1
    instance_properties {
      machine_type = "n2-standard-2"
    }
  }

  /**
   * To let VMs with affinity for any reservation consume this reservation, omit
   * the specific_reservation_required field (default) or set it to false.
   */
  specific_reservation_required = false
}

For more information about how to use Terraform, see Using Terraform with Google Cloud.

REST

To create a single-project reservation, make a POST request to the reservations.insert method.

To create a single-project reservation by specifying properties directly and without any including any optional fields, make the following POST request:

POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/reservations

{
  "name": "RESERVATION_NAME",
  "specificReservation": {
    "count": "NUMBER_OF_VMS",
    "instanceProperties": {
      "machineType": "MACHINE_TYPE",
    }
  }
}

Replace the following:

  • PROJECT_ID: the ID of the project where you want to reserve resources.

  • ZONE: the zone in which to reserve resources.

  • RESERVATION_NAME: the name of the reservation to create.

  • NUMBER_OF_VMS: the number of VMs to reserve.

  • MACHINE_TYPE: a machine type to use for each VM. If you specify an A3 machine type, then you must include the specificReservationRequired field in the request body, and set the field to true. This indicates that only VMs that specifically target the reservation can consume it. For more information, see Consume VMs from a specific reservation.

For example, to create a reservation in zone us-central1-a for ten VMs that each use an N2 predefined machine type with 4 vCPUs, make the following POST request:

POST https://compute.googleapis.com/compute/v1/projects/example-project/zones/us-central1-a/reservations

{
  "name": "my-reservation",
  "specificReservation": {
    "count": "10",
    "instanceProperties": {
      "machineType": "n2-standard-4",
    }
  }
}

Optionally, you can do one or more of the following:

  • To attach GPUs to your reserved N1 VMs, include the guestAccelerators field in the request body.

    POST https://compute.googleapis.com/compute/v1/projects/example-project/zones/us-central1-a/reservations
    
    {
      "name": "example-reservation",
      "specificReservation": {
        "instanceProperties": {
          "guestAccelerators": [
            {
              "acceleratorCount": NUMBER_OF_ACCELERATORS,
              "acceleratorType": "ACCELERATOR_TYPE"
            }
          ],
          ...
        },
        ...
      }
    }
    

    Replace the following:

  • To add one or more Local SSD disks to each reserved VM, include the localSsds field in the request body. You can specify up to 24 Local SSD disks. Each Local SSD disk is 375 GB.

    For example, to specify two Local SSD disks when creating a reservation, specify the following:

    POST https://compute.googleapis.com/compute/v1/projects/example-project/zones/us-central1-a/reservations
    
    {
      "name": "example-reservation",
      "specificReservation": {
        "instanceProperties": {
          "localSsds": [
            {
              "diskSizeGb": "375",
              "interface": "INTERFACE_1"
            },
            {
              "diskSizeGb": "375",
              "interface": "INTERFACE_2"
            }
          ],
          ...
        },
        ...
      }
    }
    

    Replace INTERFACE_1 and INTERFACE_2 with the type of interface you want each Local SSD disk to use. Specify one of the following values:

    • NVME disk interfaces: NVME

    • SCSI disk interfaces: SCSI

    Make sure that the machine type you specify for the reserved VMs supports the chosen disk interfaces. Otherwise, creating the reservation fails. For more information, see how to choose a disk interface.

  • To have the reserved VMs use a specific minimum CPU platform instead of the zone's default CPU platform, include the minCpuPlatform field in the request body.

    POST https://compute.googleapis.com/compute/v1/projects/example-project/zones/us-central1-a/reservations
    
    {
      "name": "example-reservation",
      "specificReservation": {
        "instanceProperties": {
          "minCpuPlatform": "MIN_CPU_PLATFORM",
          ...
        },
        ...
      }
    }
    

    Replace MIN_CPU_PLATFORM with a minimum CPU platform. To make sure that a CPU platform is available in the zone where you're reserving resources, view the available CPU platforms by zone.

  • To specify a compact placement policy to reduce network latency among your reserved VMs, include the resourcePolicies field in the request body.

    POST https://compute.googleapis.com/compute/v1/projects/example-project/zones/us-central1-a/reservations
    
    {
      "name": "example-reservation",
      "resourcePolicies": {
        "policy" : "projects/example-project/regions/REGION/resourcePolicies/COMPACT_PLACEMENT_POLICY_NAME"
      },
      "specificReservationRequired": true,
      ...
    }
    

    Replace the following:

    • REGION: the region where the compact placement policy is located. You can only create the reservation within the region of the placement policy.

    • COMPACT_PLACEMENT_POLICY_NAME: the name of an existing compact placement policy.

    Additionally, to avoid errors when creating a single-project reservation that specifies a compact placement policy, make sure to specify the following:

    • A supported machine type for compact placement policies.

    • The specificReservationRequired field set to true. This indicates that only VMs that specifically target this reservation can consume it.

  • To specify that only VMs that specifically target this reservation can consume it, include the specificReservationRequired field in the request body and set the field to true.

    POST https://compute.googleapis.com/compute/v1/projects/example-project/zones/us-central1-a/reservations
    
    {
      "name": "example-reservation",
      "specificReservationRequired": true,
      ...
    }
    
  • To enable Compute Engine to automatically delete the reservation, select one of the following methods:

    • To delete the reservation at a specific date and time, make a POST request to the beta.reservations.insert method. In the request body, include the deleteAtTime field.

      POST https://compute.googleapis.com/compute/beta/projects/example-project/zones/us-central1-a/reservations
      
      {
        "name": "example-reservation",
        "deleteAtTime": "DELETE_AT_TIME",
        ...
      }
      

      Replace DELETE_AT_TIME with a date and time formatted as an RFC 3339 timestamp, which must be as follows:

      YYYY-MM-DDTHH:MM:SSOFFSET
      

      Replace the following:

      • YYYY-MM-DD: a date formatted as a 4-digit year, 2-digit month, and a 2-digit day of the month, separated by hyphens (-).

      • HH:MM:SS: a time formatted as a 2-digit hour using a 24-hour time, 2-digit minutes, and 2-digit seconds, separated by colons (:).

      • OFFSET: the time zone formatted as an offset of Coordinated Universal Time (UTC). For example, to use the Pacific Standard Time (PST), specify -08:00. Alternatively, to use no offset, specify Z.

    • To delete the reservation after a specific duration, make a POST request to the beta.reservations.insert method. In the request body, include the deleteAfterDuration field.

      POST https://compute.googleapis.com/compute/beta/projects/example-project/zones/us-central1-a/reservations
      
      {
        "name": "example-reservation",
        "deleteAfterDuration": {
          "seconds": "DELETE_AFTER_DURATION"
        },
        ...
      }
      

      Replace DELETE_AFTER_DURATION with a duration in seconds. For example, specify 86400 for 86,400 seconds (1 day).

Troubleshooting

Learn how to troubleshoot reservation creation.

What's next