Modify reservations (original) (raw)

This document explains how to modify reservations. To modify reservations that are attached to commitments, seeReplace reservations that are attached to commitmentsinstead.

Modify a reservation when, for example, your capacity needs change or you want to change which workloads can consume a reservation.

Limitations

Before you modify a reservation, consider the following:

Before you begin

Required roles

To get the permissions that you need to modify reservations, ask your administrator to grant you theCompute Admin (roles/compute.admin) 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 modify reservations. To see the exact permissions that are required, expand the Required permissions section:

Required permissions

The following permissions are required to modify reservations:

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

Based on the properties that you want to modify in a reservation, use one of the following methods:

To change any properties that aren't mentioned in this list, you must create a new reservation. For instructions, seeChange other properties in a reservationin this document.

Modify the automatic deletion of a reservation

You can modify when Compute Engine automatically deletes an existing reservation by doing one of the following:

To modify the automatic deletion of a reservation, select one of the following options:

Console

  1. In the Google Cloud console, go to the Reservations page.
    Go to Reservations
  2. On the On-demand reservations tab (default), in the Name column, click the name of the reservation that you want to modify.
    The details page of the reservation opens.
  3. In the Auto-delete time row, clickEdit auto-delete time.
  4. In the Update reservation pane, do one of the following:
    • To delete the reservation at a specific date and time, do the following:
      1. If the auto-delete option isn't already enabled, click theEnable auto-delete toggle to the on position.
      2. In the Auto-delete time field, enter a date and time when Compute Engine automatically deletes the reservation.
    • Otherwise, click the Enable auto-delete toggle to the off position.
  5. Click Submit.
    Modifying your reservation might take a few seconds to complete.

gcloud

When you enable the auto-delete option in a reservation, you can specify a date and time when the reservation should be deleted or specify a duration after which the reservation should be deleted.

To enable the auto-delete option or change when the reservation should be deleted, do one of the following:

gcloud beta compute reservations update RESERVATION_NAME \  
    --delete-at-time=DELETE_AT_TIME \  
    --zone=ZONE  

Replace the following:

gcloud beta compute reservations update RESERVATION_NAME \  
    --delete-after-duration=DELETE_AFTER_DURATION \  
    --zone=ZONE  

Replace the following:

To disable the auto-delete option, use thegcloud beta compute reservations update commandwith the --disable-auto-delete flag.

gcloud beta compute reservations update RESERVATION_NAME \
    --disable-auto-delete \
    --zone=ZONE

Replace the following:

REST

When you enable the auto-delete option in a reservation, you can specify a date and time when the reservation should be deleted or specify a duration after which the reservation should be deleted.

To enable the auto-delete option or change when the reservation should be deleted, do one of the following:

PATCH https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/zones/ZONE/reservations/RESERVATION_NAME?paths=deleteAtTime  
{  
  "name": "RESERVATION_NAME",  
  "deleteAtTime": "DELETE_AT_TIME"  
}  

Replace the following:

PATCH https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/zones/ZONE/reservations/RESERVATION_NAME?paths=deleteAfterDuration.seconds  
{  
  "name": "RESERVATION_NAME",  
  "deleteAfterDuration": {  
    "seconds": "DELETE_AFTER_DURATION"  
  }  
}  

Replace the following:

To disable the auto-delete option, make a PATCH request to thebeta.reservations.update method. In the request, specify thepaths=deleteAtTime&paths=deleteAfterDuration query parameter and omit the request body.

PATCH https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/zones/ZONE/reservations/RESERVATION_NAME?paths=deleteAtTime&paths=deleteAfterDuration

Replace the following:

Modify the consumer projects in a shared reservation

To avoid errors when you modify the consumer projects for a shared reservation, consider the following:

After you modify the consumer projects for a shared reservation, the consumption of the reservation might change. For example, if you configured the reservation to let any matching instances consume it (the default configuration), then any newly added consumer projects might immediately start consuming the reservation. To learn more about which matching reservations projects consume first, see thereservations consumption order.

To modify the consumer projects that can consume a shared reservation, select one of the following options:

Console

  1. In the Google Cloud console, go to the Reservations page.
    Go to Reservations
  2. On the On-demand reservations tab (default), in the Name column, click the name of the reservation you want to describe.
    The details page for the reservation opens.
  3. Click Edit.
  4. In the Selected projects section, do one of the following:
    • To stop sharing the reservation with a specific consumer project, click Delete.
    • To start sharing the reservation with one or more specific projects, do the following:
      1. Click Add projects.
      2. Select the checkbox for each project from the owner project's organization that you want to share the reservation with. You can share a shared reservation with up to 100 consumer projects.
      3. Click Select.
  5. To confirm your changes, click Save.
    Modifying your reservation might take a few seconds to complete.

gcloud

When you modify the consumer projects for a shared reservation, you must specify a comma-separated list of IDs of projects that you want to allow, or stop allowing, to consume the shared reservation. These projects must be in the same organization as the owner project. Don't specify the owner project in the list. By default, it's already allowed to consume the shared reservation.

To modify the consumer projects for a shared reservation, do one of the following:

gcloud compute reservations update RESERVATION_NAME \  
    --add-share-with=CONSUMER_PROJECT_IDS \  
    --zone=ZONE  

Replace the following:

gcloud compute reservations update RESERVATION_NAME \  
    --remove-share-with=CONSUMER_PROJECT_IDS \  
    --zone=ZONE  

Replace the following:

gcloud beta compute reservations update RESERVATION_NAME \  
    --share-with=CONSUMER_PROJECT_IDS \  
    --zone=ZONE  

Replace the following:

REST

When you modify the consumer projects for a shared reservation, you must specify the IDs of the projects that you want to allow, or stop allowing, to consume the shared reservation. These projects must be in the same organization as the owner project. Don't specify the owner project. By default, it's already allowed to consume the shared reservation.

To modify the consumer projects for a shared reservation, do one of the following:

PATCH https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/reservations/RESERVATION_NAME?paths=shareSettings.projectMap.CONSUMER_PROJECT_ID_1&paths=shareSettings.projectMap.CONSUMER_PROJECT_ID_2  
{  
  "name": "RESERVATION_NAME",  
  "shareSetting": {  
    "projectMap": {  
      "CONSUMER_PROJECT_ID_1": {  
        "projectId": "CONSUMER_PROJECT_ID_1"  
      },  
      "CONSUMER_PROJECT_ID_2": {  
        "projectId": "CONSUMER_PROJECT_ID_2"  
      }  
    }  
  }  
}  

Replace the following:

PATCH https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/reservations/RESERVATION_NAME?paths=shareSettings.projectMap.CONSUMER_PROJECT_ID_1&paths=shareSettings.projectMap.CONSUMER_PROJECT_ID_2  
{  
  "name": "RESERVATION_NAME"  
}  

Replace the following:

Modify the number of reserved instances in a reservation

You can increase or decrease the number of reserved compute instances in a reservation. However, before you modify the number of instances, consider the following to avoid errors:

To modify the number of reserved instances in a reservation, select one of the following options:

Console

  1. In the Google Cloud console, go to the Reservations page.
    Go to Reservations
  2. On the On-demand reservations tab (default), in the Name column, click the name of the reservation that you want to modify.
    The details page for the reservation opens.
  3. Click Edit.
  4. In the Number of VM instances field, enter the updated number of instances to reserve.
  5. To confirm, click Save.
    Modifying your reservation might take a few seconds to complete.

gcloud

To modify the number of reserved instances in a reservation, use thegcloud compute reservations update command.

gcloud compute reservations update RESERVATION_NAME \
    --vm-count=NUMBER_OF_VMS \
    --zone=ZONE

Replace the following:

REST

To modify the number of reserved instances in a reservation, make a POSTrequest to thereservations.resize method.

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

{
  "specificSkuCount": "NUMBER_OF_VMS"
}

Replace the following:

Modify the sharing policy of a reservation

When you modify thesharing policyof a reservation of GPU compute instances, you control whether Vertex AI training or prediction jobs consume the reservation.

Before you disallow Vertex AI jobs from consuming a reservation, stop any Vertex AI jobs that use it. Otherwise, you encounter errors.

To modify the sharing policy of a reservation of GPU instances, select one of the following options:

Console

  1. In the Google Cloud console, go to the Reservations page.
    Go to Reservations
  2. On the On-demand reservations tab (default), in the Name column, click the name of the reservation of GPU instances that you want to modify. A page that gives the details of the reservation appears.
  3. In the Share with other Google Cloud services row, clickEdit service sharing settings.
  4. In the Reservation sharing pane, do one of the following:
    • To allow Vertex AI jobs to consume the reservation, select Share reservation.
    • To disallow Vertex AI jobs to consume the reservation, select Don't share reservation.
  5. Click Save.
    Modifying your reservation might take a few seconds to complete.

gcloud

To modify the sharing policy of a reservation of GPU instances, use thegcloud compute reservations update commandwith the --reservation-sharing-policy flag.

gcloud compute reservations update RESERVATION_NAME \
    --reservation-sharing-policy=SHARING_POLICY \
    --zone=ZONE

Replace the following:

REST

To modify the sharing policy of a reservation of GPU instances, make aPATCH request to thereservations.update method. In the request URL, include the paths query parameter set toreservationSharingPolicy.serviceShareType.

PATCH https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/reservations/RESERVATION_NAME?paths=reservationSharingPolicy.serviceShareType

{
  "name": "RESERVATION_NAME",
  "reservationSharingPolicy": {
    "serviceShareType": "SHARING_POLICY"
  }
}

Replace the following:

Change other properties in a reservation

If you want to modify a property that isn't mentioned in theModify reservationssection, then you must create a replacement reservation instead.

To replace a reservation without risking an unintended reduction in your reserved capacity, do the following:

  1. Create a newsingle-projectorshared reservationwith updated properties.
  2. If you don't need the original reservation anymore, thendelete the reservation.

Troubleshoot

Learn how totroubleshoot issues with reservation updates.

What's next