Consultar reservas o solicitudes de reserva futuras


En este documento, se explica cómo ver tus reservas o solicitudes de reserva futuras. Para obtener más información sobre los diferentes tipos de reservas, consulta Tipo de aprovisionamiento.

Cuando veas tus reservas o solicitudes de reserva futuras, puedes hacer lo siguiente:

  • Ver la configuración de reservas. Esta revisión te ayuda a verificar los detalles de tus reservas, a asegurarte de que cumplan con tus necesidades y a planificar la capacidad.

  • Determina la cantidad de instancias consumibles. Esta verificación te ayuda a determinar cuántas instancias de Compute Engine pueden consumir tu capacidad reservada.

Limitaciones

Solo puedes ver una reserva compartida o una solicitud de reserva futura compartida en el proyecto en el que la creaste.

Antes de comenzar

  • Si aún no lo hiciste, configura la autenticación. La autenticación es el proceso mediante el cual se verifica tu identidad para acceder a los servicios y las APIs de Google Cloud . Para ejecutar código o muestras desde un entorno de desarrollo local, puedes autenticarte en Compute Engine seleccionando una de las siguientes opciones:

    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.
    3. Go

      Para usar las muestras de Go de esta página en un entorno de desarrollo local, instala e inicializa gcloud CLI y, luego, configura las credenciales predeterminadas de la aplicación con tus credenciales de usuario.

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

        gcloud init
      3. If you're using a local shell, then create local authentication credentials for your user account:

        gcloud auth application-default login

        You don't need to do this if you're using Cloud Shell.

      Para obtener más información, consulta Set up authentication for a local development environment.

      Java

      Para usar las muestras de Java de esta página en un entorno de desarrollo local, instala e inicializa gcloud CLI y, luego, configura las credenciales predeterminadas de la aplicación con tus credenciales de usuario.

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

        gcloud init
      3. If you're using a local shell, then create local authentication credentials for your user account:

        gcloud auth application-default login

        You don't need to do this if you're using Cloud Shell.

      Para obtener más información, consulta Set up authentication for a local development environment.

      Node.js

      Para usar las muestras de Node.js de esta página en un entorno de desarrollo local, instala e inicializa gcloud CLI y, luego, configura las credenciales predeterminadas de la aplicación con tus credenciales de usuario.

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

        gcloud init
      3. If you're using a local shell, then create local authentication credentials for your user account:

        gcloud auth application-default login

        You don't need to do this if you're using Cloud Shell.

      Para obtener más información, consulta Set up authentication for a local development environment.

      Python

      Para usar las muestras de Python de esta página en un entorno de desarrollo local, instala e inicializa gcloud CLI y, luego, configura las credenciales predeterminadas de la aplicación con tus credenciales de usuario.

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

        gcloud init
      3. If you're using a local shell, then create local authentication credentials for your user account:

        gcloud auth application-default login

        You don't need to do this if you're using Cloud Shell.

      Para obtener más información, consulta Set up authentication for a local development environment.

      REST

      Para usar las muestras de la API de REST en esta página en un entorno de desarrollo local, debes usar las credenciales que proporcionas a la CLI de gcloud.

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

        gcloud init

      Para obtener más información, consulta Autentica para usar REST en la documentación de autenticación de Google Cloud .

Roles obligatorios

Para obtener los permisos que necesitas para ver las reservas o las solicitudes de reserva futuras, pídele a tu administrador que te otorgue el rol de IAM Administrador de Compute (roles/compute.admin) en el proyecto. Para obtener más información sobre cómo otorgar roles, consulta Administra el acceso a proyectos, carpetas y organizaciones.

Este rol predefinido contiene los permisos necesarios para ver las reservas o las solicitudes de reserva futuras. Para ver los permisos exactos que son necesarios, expande la sección Permisos requeridos:

Permisos necesarios

Se requieren los siguientes permisos para ver las reservas o las solicitudes de reserva futuras:

  • Para ver una lista de reservas: compute.reservations.list en el proyecto
  • Para ver una lista de solicitudes de reserva futuras, usa compute.futureReservations.list en el proyecto.
  • Para ver los detalles de una reserva: compute.reservations.get en el proyecto
  • Para ver los detalles de una solicitud de reserva futura, usa compute.futureReservations.get en el proyecto.

También puedes obtener estos permisos con roles personalizados o con otros roles predefinidos.

Cómo ver la configuración de reservas

En las siguientes secciones, se explica cómo ver la configuración de tus reservas o solicitudes de reserva futuras.

Ver reservas

Para ver la configuración de una o más reservas, usa uno de los siguientes métodos que se describen en esta sección:

  • Para ver una descripción general de todas las reservas de tu proyecto, consulta una lista de tus reservas.

  • Para ver los detalles completos de una sola reserva, consulta los detalles de la reserva.

Para ver los campos deleteAtTime y reservationSharingPolicy (Versión preliminar) en una reserva, consulta los detalles de una reserva con Google Cloud CLI o consulta las reservas con la API de REST. Si no necesitas estos campos, selecciona cualquiera de las siguientes opciones para ver las reservas:

Console

  1. En la consola de Google Cloud, ve a la página Reservas.

    Ir a Reservas

    En la pestaña Reservas según demanda (predeterminada), la tabla muestra cada reserva y cada columna de la tabla describe una propiedad.

  2. Opcional: Para definir mejor tu lista de reservas, en el campo Filtro , selecciona las propiedades por las que deseas filtrar las reservas.

  3. Para ver los detalles de una reserva, en la columna Nombre, haz clic en el nombre de la reserva.

    Se abrirá una página con los detalles de la reserva.

gcloud

  • Para ver una lista de tus reservas, usa el comando gcloud compute reservations list:

    gcloud compute reservations list
    

    El resultado es similar al siguiente ejemplo.

    NAME: r-01
    IN_USE_COUNT: 0
    COUNT: 5
    ZONE: us-central1-a
    SHARE_TYPE: LOCAL
    
    NAME: r-02
    IN_USE_COUNT: 3
    COUNT: 10
    ZONE: us-central1-f
    SHARE_TYPE: LOCAL
    

    De forma opcional, para definir mejor una lista de reservas con una expresión de filtro, incluye la marca --filter:

    gcloud compute reservations list \
        --filter="FILTER_EXPRESSION"
    

    Reemplaza FILTER_EXPRESSION por una expresión de filtro.

  • Para ver los detalles de una reserva, usa el comando gcloud compute reservations describe:

    gcloud compute reservations describe RESERVATION_NAME \
        --zone=ZONE
    

    Reemplaza lo siguiente:

    • RESERVATION_NAME: Es el nombre de una reserva existente.

    • ZONE: Es la zona en la que existe la reserva.

    El resultado es similar al siguiente ejemplo.

    creationTimestamp: '2024-10-11T03:25:23.192-07:00'
    id: '4488228526648280060'
    kind: compute#reservation
    name: r-01
    selfLink: https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-a/reservations/r-01
    shareSettings:
      shareType: LOCAL
    specificReservation:
      assuredCount: '50'
      count: '50'
      inUseCount: '25'
      instanceProperties:
        machineType: n2-standard-2
    specificReservationRequired: false
    status: READY
    zone: https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-a
    

Go

  • Para ver una lista de tus reservas, usa la siguiente muestra de código:

    // Copyright 2024 Google LLC
    //
    // Licensed under the Apache License, Version 2.0 (the "License");
    // you may not use this file except in compliance with the License.
    // You may obtain a copy of the License at
    //
    //     https://www.apache.org/licenses/LICENSE-2.0
    //
    // Unless required by applicable law or agreed to in writing, software
    // distributed under the License is distributed on an "AS IS" BASIS,
    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    // See the License for the specific language governing permissions and
    // limitations under the License.
    
    package snippets
    
    import (
    	"context"
    	"fmt"
    	"io"
    
    	compute "cloud.google.com/go/compute/apiv1"
    	computepb "cloud.google.com/go/compute/apiv1/computepb"
    	"google.golang.org/api/iterator"
    )
    
    // Get list of reservations for given project in particular zone
    func listReservations(w io.Writer, projectID, zone string) error {
    	// projectID := "your_project_id"
    	// zone := "us-west3-a"
    
    	ctx := context.Background()
    	reservationsClient, err := compute.NewReservationsRESTClient(ctx)
    	if err != nil {
    		return err
    	}
    	defer reservationsClient.Close()
    
    	req := &computepb.ListReservationsRequest{
    		Project: projectID,
    		Zone:    zone,
    	}
    
    	it := reservationsClient.List(ctx, req)
    	fmt.Fprintf(w, "Instances found in zone %s:\n", zone)
    	for {
    		instance, err := it.Next()
    		if err == iterator.Done {
    			break
    		}
    		if err != nil {
    			return err
    		}
    		fmt.Fprintf(w, "- %s %d\n", instance.GetName(), instance.GetSpecificReservation().GetCount())
    	}
    
    	return nil
    }
    
    
  • Para ver los detalles de una reserva, usa la siguiente muestra de código:

    // Copyright 2024 Google LLC
    //
    // Licensed under the Apache License, Version 2.0 (the "License");
    // you may not use this file except in compliance with the License.
    // You may obtain a copy of the License at
    //
    //     https://www.apache.org/licenses/LICENSE-2.0
    //
    // Unless required by applicable law or agreed to in writing, software
    // distributed under the License is distributed on an "AS IS" BASIS,
    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    // See the License for the specific language governing permissions and
    // limitations under the License.
    
    package snippets
    
    import (
    	"context"
    	"fmt"
    	"io"
    
    	compute "cloud.google.com/go/compute/apiv1"
    	computepb "cloud.google.com/go/compute/apiv1/computepb"
    )
    
    // Get certain reservation for given project and zone
    func getReservation(w io.Writer, projectID, zone, reservationName string) (*computepb.Reservation, error) {
    	// projectID := "your_project_id"
    	// zone := "us-west3-a"
    	// reservationName := "your_reservation_name"
    
    	ctx := context.Background()
    	reservationsClient, err := compute.NewReservationsRESTClient(ctx)
    	if err != nil {
    		return nil, err
    	}
    	defer reservationsClient.Close()
    
    	req := &computepb.GetReservationRequest{
    		Project:     projectID,
    		Reservation: reservationName,
    		Zone:        zone,
    	}
    
    	reservation, err := reservationsClient.Get(ctx, req)
    	if err != nil {
    		return nil, fmt.Errorf("unable to delete reservation: %w", err)
    	}
    
    	fmt.Fprintf(w, "Reservation: %s\n", reservation.GetName())
    
    	return reservation, nil
    }
    
    

Java

  • Para ver una lista de tus reservas, usa la siguiente muestra de código:

    /*
     * Copyright 2024 Google LLC
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *   http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    
    package compute.reservation;
    
    import com.google.cloud.compute.v1.Reservation;
    import com.google.cloud.compute.v1.ReservationsClient;
    import java.io.IOException;
    import java.util.ArrayList;
    import java.util.List;
    
    public class ListReservations {
    
      public static void main(String[] args) throws IOException {
        // TODO(developer): Replace these variables before running the sample.
        // Project ID or project number of the Cloud project you want to use.
        String project = "YOUR_PROJECT_ID";
        // Zone in which reservations are located.
        String zone = "us-central1-a";
    
        listReservations(project, zone);
      }
    
      // List all reservations in the given project and zone.
      public static List<Reservation> listReservations(String project, String zone) throws IOException {
        // Initialize client that will be used to send requests. This client only needs to be created
        // once, and can be reused for multiple requests.
        List<Reservation> listOfReservations = new ArrayList<>();
    
        try (ReservationsClient reservationsClient = ReservationsClient.create()) {
          for (Reservation reservation : reservationsClient.list(project, zone).iterateAll()) {
            listOfReservations.add(reservation);
            System.out.println("Reservation: " + reservation.getName());
          }
        }
        return listOfReservations;
      }
    }
  • Para ver los detalles de una reserva, usa la siguiente muestra de código:

    /*
     * Copyright 2024 Google LLC
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     * http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    
    package compute.reservation;
    
    import com.google.cloud.compute.v1.Reservation;
    import com.google.cloud.compute.v1.ReservationsClient;
    import java.io.IOException;
    import java.util.concurrent.ExecutionException;
    import java.util.concurrent.TimeoutException;
    
    public class GetReservation {
    
      public static void main(String[] args)
          throws IOException, ExecutionException, InterruptedException, TimeoutException {
        // TODO(developer): Replace these variables before running the sample.
        // Project ID or project number of the Cloud project you want to use.
        String projectId = "YOUR_PROJECT_ID";
        // Name of the zone in which you want to create the reservation.
        String zone = "us-central1-a";
        // Name of the reservation you want to create.
        String reservationName = "test-reservation-name";
    
        getReservation(projectId, reservationName, zone);
      }
    
      // Retrieve a reservation with the given name in the given zone.
      public static Reservation getReservation(
          String projectId, String reservationName, String zone)
          throws IOException {
        // Initialize client that will be used to send requests. This client only needs to be created
        // once, and can be reused for multiple requests.
        try (ReservationsClient reservationsClient = ReservationsClient.create()) {
    
          // Get the reservation.
          Reservation reservation = reservationsClient.get(projectId, zone, reservationName);
    
          System.out.println("Reservation: " + reservation.getName());
          return reservation;
        }
      }
    }

Node.js

  • Para ver una lista de tus reservas, usa la siguiente muestra de código:

    /*
     * Copyright 2024 Google LLC
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *     https://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    
    'use strict';
    
    async function main() {
      // Import the Compute library
      const computeLib = require('@google-cloud/compute');
    
      // Instantiate a reservationsClient
      const reservationsClient = new computeLib.ReservationsClient();
    
      /**
       * TODO(developer): Update these variables before running the sample.
       */
      // The ID of the project where your reservations are located.
      const projectId = await reservationsClient.getProjectId();
      // The zone where your reservations are located.
      const zone = 'us-central1-a';
    
      async function callGetReservations() {
        const reservations = (
          await reservationsClient.list({
            project: projectId,
            zone,
          })
        )[0];
    
        console.log(JSON.stringify(reservations));
      }
    
      await callGetReservations();
    }
    
    main().catch(err => {
      console.error(err);
      process.exitCode = 1;
    });
    
  • Para ver los detalles de una reserva, usa la siguiente muestra de código:

    /*
     * Copyright 2024 Google LLC
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *     https://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    
    'use strict';
    
    async function main(reservationName) {
      // Import the Compute library
      const computeLib = require('@google-cloud/compute');
    
      // Instantiate a reservationsClient
      const reservationsClient = new computeLib.ReservationsClient();
    
      /**
       * TODO(developer): Update/uncomment these variables before running the sample.
       */
      // The ID of the project where your reservation is located.
      const projectId = await reservationsClient.getProjectId();
      // The zone where your reservation is located.
      const zone = 'us-central1-a';
      // The name of the reservation to return.
      // reservationName = 'reservation-01';
    
      async function callGetReservation() {
        const requestedReservation = (
          await reservationsClient.get({
            project: projectId,
            zone,
            reservation: reservationName,
          })
        )[0];
    
        console.log(JSON.stringify(requestedReservation));
      }
    
      await callGetReservation();
    }
    
    main(...process.argv.slice(2)).catch(err => {
      console.error(err);
      process.exitCode = 1;
    });
    

Python

  • Para ver una lista de tus reservas, usa la siguiente muestra de código:

    # Copyright 2024 Google LLC
    #
    # Licensed under the Apache License, Version 2.0 (the "License");
    # you may not use this file except in compliance with the License.
    # You may obtain a copy of the License at
    #
    #    https://www.apache.org/licenses/LICENSE-2.0
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an "AS IS" BASIS,
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # See the License for the specific language governing permissions and
    # limitations under the License.
    
    
    # This file is automatically generated. Please do not modify it directly.
    # Find the relevant recipe file in the samples/recipes or samples/ingredients
    # directory and apply your changes there.
    
    
    from google.cloud import compute_v1
    from google.cloud.compute_v1.services.reservations.pagers import ListPager
    
    
    def list_compute_reservation(project_id: str, zone: str = "us-central1-a") -> ListPager:
        """
        Lists all compute reservations in a specified Google Cloud project and zone.
        Args:
            project_id (str): The ID of the Google Cloud project.
            zone (str): The zone of the reservations.
        Returns:
            ListPager: A pager object containing the list of reservations.
        """
    
        client = compute_v1.ReservationsClient()
    
        reservations_list = client.list(
            project=project_id,
            zone=zone,
        )
    
        for reservation in reservations_list:
            print("Name: ", reservation.name)
            print(
                "Machine type: ",
                reservation.specific_reservation.instance_properties.machine_type,
            )
        # Example response:
        # Name:  my-reservation_1
        # Machine type:  n1-standard-1
        # Name:  my-reservation_2
        # Machine type:  n1-standard-1
    
        return reservations_list
    
    
    
  • Para ver los detalles de una reserva, usa la siguiente muestra de código:

    # Copyright 2024 Google LLC
    #
    # Licensed under the Apache License, Version 2.0 (the "License");
    # you may not use this file except in compliance with the License.
    # You may obtain a copy of the License at
    #
    #    https://www.apache.org/licenses/LICENSE-2.0
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an "AS IS" BASIS,
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # See the License for the specific language governing permissions and
    # limitations under the License.
    
    
    # This file is automatically generated. Please do not modify it directly.
    # Find the relevant recipe file in the samples/recipes or samples/ingredients
    # directory and apply your changes there.
    
    
    from google.cloud import compute_v1
    from google.cloud.compute_v1.types import compute
    
    
    def get_compute_reservation(
        project_id: str,
        zone: str = "us-central1-a",
        reservation_name="your-reservation-name",
    ) -> compute.Reservation:
        """
        Retrieves a compute reservation from GCP.
        Args:
            project_id (str): The ID of the Google Cloud project.
            zone (str): The zone of the reservation.
            reservation_name (str): The name of the reservation to retrieve.
        Returns:
            compute.Reservation: The reservation object retrieved from Google Cloud.
        """
    
        client = compute_v1.ReservationsClient()
    
        reservation = client.get(
            project=project_id,
            zone=zone,
            reservation=reservation_name,
        )
    
        print("Name: ", reservation.name)
        print("STATUS: ", reservation.status)
        print(reservation.specific_reservation)
        # Example response:
        # Name:  your-reservation-name
        # STATUS:  READY
        # count: 3
        # instance_properties {
        #   machine_type: "n1-standard-1"
        #   local_ssds {
        #     disk_size_gb: 375
        #     interface: "NVME"
        #   }
        # ...
    
        return reservation
    
    
    

REST

  • Para ver una lista de tus reservas, realiza una solicitud GET al método reservations.list:

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

    Reemplaza lo siguiente:

    • PROJECT_ID: Es el ID del proyecto en el que creaste tus reservas.

    • ZONE: Es la zona en la que se encuentran tus reservas.

    El resultado es similar al siguiente ejemplo.

    {
      "kind": "compute#reservation",
      "id": "4100668622331754141",
      "creationTimestamp": "2019-09-27T08:21:14.707-07:00",
      "selfLink": "https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-a/reservations/reservation-05",
      "zone": "https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-a",
      "name": "reservation-05",
      "specificReservation": {
        "instanceProperties": {
          "machineType": "n1-standard-2"
        },
        "count": "100",
        "inUseCount": "0",
        "assuredCount": "100"
      },
      "specificReservationRequired": false,
      "status": "READY",
      "shareSettings": {
        "shareType": "LOCAL"
      }
    },
    {
      "kind": "compute#reservation",
      "id": "2533514314332214789",
      "creationTimestamp": "2019-09-27T08:21:14.707-07:00",
      "selfLink": "https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-a/reservations/reservation-04",
      "zone": "https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-a",
      "name": "reservation-04",
      "specificReservation": {
        "instanceProperties": {
          "machineType": "n1-standard-2",
          "guestAccelerators": [
            {
              "acceleratorType": "nvidia-tesla-t4",
              "acceleratorCount": 1
            }
          ],
          "localSsds": [
            {
              "diskSizeGb": "375",
              "interface": "SCSI"
            }
          ]
        },
        "count": "50",
        "inUseCount": "25",
        "assuredCount": "50"
      },
      "specificReservationRequired": false,
      "status": "READY",
      "shareSettings": {
        "shareType": "LOCAL"
      }
    }
    

    De forma opcional, para definir mejor una lista de reservas con una expresión de filtro, incluye el parámetro de consulta filter:

    GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/reservations?filter=FILTER_EXPRESSION
    

    Reemplaza FILTER_EXPRESSION por una expresión de filtro que use valores codificados en URL.

  • Para ver los detalles de una reserva, haz una solicitud GET al método reservations.get.

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

    Reemplaza lo siguiente:

    • PROJECT_ID: Es el ID del proyecto en el que creaste la reserva.

    • ZONE: Es la zona en la que existe la reserva.

    • RESERVATION_NAME: Es el nombre de una reserva existente.

    El resultado es similar al siguiente ejemplo.

    {
      "kind": "compute#reservation",
      "id": "4488228526648280060",
      "creationTimestamp": "2024-10-11T03:25:23.192-07:00",
      "selfLink": "https://www.googleapis.com/compute/v1/projects/davide-experimental/zones/us-central1-a/reservations/r-01",
      "zone": "https://www.googleapis.com/compute/v1/projects/davide-experimental/zones/us-central1-a",
      "name": "r-01",
      "specificReservation": {
        "instanceProperties": {
          "machineType": "n2-standard-2"
        },
        "count": "50",
        "inUseCount": "25",
        "assuredCount": "50"
      },
      "specificReservationRequired": false,
      "status": "READY",
      "shareSettings": {
        "shareType": "LOCAL"
      }
    }
    

Consultar las solicitudes de reserva futuras

Para ver la configuración de una o más solicitudes de reserva futuras, usa uno de los siguientes métodos que se describen en esta sección:

  • Para obtener una descripción general de todas las solicitudes de reserva futuras de tu proyecto, consulta una lista de tus solicitudes.

  • Para ver los detalles completos de una sola solicitud de reserva futura, consulta los detalles de la solicitud.

Para ver las solicitudes de reserva futuras, selecciona una de las siguientes opciones:

Console

  1. En la consola de Google Cloud, ve a la página Reservas.

    Ir a Reservas

  2. Haz clic en la pestaña Reservas futuras.

    En la tabla, se enumera cada solicitud de reserva futura y cada columna de la tabla describe una propiedad.

  3. Opcional: Para definir mejor tu lista de solicitudes, en el campo Filtro , selecciona las propiedades por las que deseas filtrar las solicitudes.

  4. Para ver los detalles de una solicitud, en la columna Nombre, haz clic en el nombre de la solicitud.

    Se abrirá una página que muestra los detalles de la solicitud de reserva futura.

gcloud

  • Para ver una lista de tus solicitudes de reserva futuras, usa el comando gcloud beta compute future-reservations list:

    gcloud beta compute future-reservations list
    

    El resultado es similar al siguiente ejemplo.

    NAME: fr-04
    TOTAL_COUNT: 100
    START_TIME: 2025-07-20T07:00:00Z
    END_TIME: 2025-08-05T07:00:00Z
    PROCUREMENT_STATUS: FULFILLED
    ZONE: us-east1-a
    
    NAME: fr-05
    TOTAL_COUNT: 10
    START_TIME: 2025-07-20T07:00:00Z
    END_TIME: 2025-12-01T00:00:00Z
    PROCUREMENT_STATUS: PENDING_APPROVAL
    ZONE: us-west1-c
    

    De forma opcional, para definir mejor una lista de solicitudes de reserva futuras con una expresión de filtro, incluye la marca --filter:

    gcloud beta compute future-reservations list \
        --filter="FILTER_EXPRESSION"
    

    Reemplaza FILTER_EXPRESSION por una expresión de filtro.

  • Para ver los detalles de una solicitud de reserva futura, usa el comando gcloud beta compute future-reservations describe:

    gcloud beta compute future-reservations describe FUTURE_RESERVATION_NAME \
        --zone=ZONE
    

    Reemplaza lo siguiente:

    • FUTURE_RESERVATION_NAME: El nombre de una solicitud de reserva futura existente.

    • ZONE: Es la zona en la que existe la solicitud de reserva futura.

    El resultado es similar al siguiente ejemplo.

    autoCreatedReservationsDeleteTime: '2025-05-02T01:00:00Z'
    creationTimestamp: '2025-03-23T10:08:31.613-07:00'
    id: '5212276518668495076'
    kind: compute#futureReservation
    name: fr-01
    planningStatus: SUBMITTED
    selfLink: https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-a/futureReservations/fr-01
    selfLinkWithId: https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-a/futureReservations/5212276518668495076
    shareSettings:
      shareType: LOCAL
    specificSkuProperties:
      instanceProperties:
        machineType: n1-standard-64
      totalCount: '800'
    status:
      existingMatchingUsageInfo:
        count: '3'
        timestamp: '2025-03-30T01:00:00Z'
      lockTime: '2025-03-30T17:09:59.297799Z'
      procurementStatus: APPROVED
    timeWindow:
      endTime: '2025-05-02T01:00:00Z'
      startTime: '2025-04-30T17:30:00Z'
    zone: https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-a
    

REST

  • Para ver una lista de tus solicitudes de reserva futuras, realiza una solicitud GET al método futureReservations.list beta:

    GET https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/zones/ZONE/futureReservations
    

    Reemplaza lo siguiente:

    • PROJECT_ID: El ID del proyecto en el que creaste tus solicitudes de reserva futuras.

    • ZONE: Es la zona en la que se encuentran tus solicitudes de reserva futuras.

    El resultado es similar al siguiente ejemplo.

    {
      "id": "projects/my-project/zones/us-east1-a/futureReservations",
      "items": [
        {
          "id": "743865190848184978",
          "creationTimestamp": "2025-03-23T18:16:45.274-07:00",
          "selfLink": "https://www.googleapis.com/compute/beta/projects/my-project/zones/us-east1-a/futureReservations/fr-base",
          "selfLinkWithId": "https://www.googleapis.com/compute/beta/projects/my-project/zones/us-east1-a/futureReservations/743865190848184978",
          "zone": "https://www.googleapis.com/compute/beta/projects/my-project/zones/us-east1-a",
          "name": "fr-base",
          "specificSkuProperties": {
            "instanceProperties": {
              "machineType": "n1-standard-1"
            },
            "totalCount": "100"
          },
          "planningStatus": "SUBMITTED",
          "timeWindow": {
            "endTime": "2025-05-02T01:00:00Z",
            "startTime": "2025-04-30T17:30:00Z"
          },
          "status": {
            "procurementStatus": "FULFILLED",
            "lockTime": "2025-03-30T07:00:00Z",
            "existingMatchingUsageInfo": {
              "count": "3",
              "timestamp": "2025-03-30T01:00:00Z"
            }
          },
          "kind": "compute#futureReservation"
        },
        ...
      ],
      "selfLink": "https://www.googleapis.com/compute/beta/projects/my-project/zones/us-east1-a/futureReservations",
      "etag": "AnzKY34l-cvvV-JnniESJ0dtQvQ=/hvc4jaHpxFAZmOt1FVtKNgzZu-M=",
      "kind": "compute#futureReservationsListResponse"
    }
    

    De forma opcional, para definir mejor una lista de solicitudes de reserva futuras con una expresión de filtro, incluye el parámetro de consulta filter:

    GET https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/aggregated/futureReservations?filter=FILTER_EXPRESSION
    

    Reemplaza FILTER_EXPRESSION por una expresión de filtro que use valores codificados en URL.

  • Para ver los detalles de una solicitud de reserva futura, realiza una solicitud GET al método futureReservations.get beta:

    GET https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/zones/ZONE/futureReservations/FUTURE_RESERVATION_NAME
    

    Reemplaza lo siguiente:

    • PROJECT_ID: Es el ID del proyecto en el que creaste la solicitud de reserva futura.

    • ZONE: Es la zona en la que existe la solicitud de reserva futura.

    • FUTURE_RESERVATION_NAME: El nombre de una solicitud de reserva futura existente.

    El resultado es similar a este:

    {
      "autoCreatedReservationsDeleteTime": "2025-05-02T01:00:00Z",
      "creationTimestamp": "2025-03-23T10:08:31.613-07:00",
      "id": "5212276518668495076",
      "kind": "compute#futureReservation",
      "name": "fr-01",
      "planningStatus": "SUBMITTED",
      "selfLink": "https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-a/futureReservations/fr-01",
      "selfLinkWithId": "https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-a/futureReservations/5212276518668495076",
      "shareSettings": {
        "shareType": "LOCAL"
      },
      "specificSkuProperties": {
        "instanceProperties": {
          "machineType": "n1-standard-64"
        },
        "totalCount": "800"
      },
      "status": {
        "lockTime": "2025-03-30T17:09:59.297799Z",
        "procurementStatus": "APPROVED",
        "existingMatchingUsageInfo": {
          "count": "3",
          "timestamp": "2025-03-30T01:00:00Z"
        }
      },
      "timeWindow": {
        "endTime": "2025-05-02T01:00:00Z",
        "startTime": "2025-04-30T17:30:00Z"
      },
      "zone": "https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-a"
    }
    

Determina la cantidad de instancias consumibles

Para determinar la cantidad de instancias de procesamiento que pueden consumir tu capacidad reservada, realiza una de las siguientes acciones:

Instancias consumibles en una reserva

Cuando consultas los detalles de una reserva, puedes ver cuántas instancias de procesamiento consumen la reserva y cuántas instancias pueden hacerlo. Para ello, verifica los siguientes campos:

  • Recuento garantizado (assuredCount): Es la cantidad de instancias reservadas en la zona de la reserva para tu proyecto y para cualquier proyecto con el que se comparta una reserva compartida.

  • Recuento total (count): Es la cantidad de instancias reservadas especificadas en la reserva. Este número debe coincidir con el recuento garantizado.

  • Máquinas en uso (inUseCount): Es la cantidad de instancias en ejecución en tu proyecto, o un proyecto con el que se comparte una reserva, que consumen la reserva.

Por ejemplo, si el recuento garantizado (assuredCount) y el recuento total (count) son 50 y la cantidad de instancias que consumen la reserva (inUseCount) es 25, 25 instancias más pueden consumir la reserva antes de que se consuma por completo.

Instancias consumibles en una solicitud de reserva futura

Puedes determinar la cantidad de instancias de procesamiento para las que Compute Engine crea una reserva en la hora de inicio de una solicitud de reserva futura. Para un borrador, una solicitud pendiente de aprobación o una solicitud aprobada, puedes determinar este número de la siguiente manera:

  1. Consulta cuántas instancias en ejecución y reservas sin usar hay en tu proyecto y en cualquier proyecto con el que se comparta la solicitud, y haz que coincidan con las propiedades de la solicitud.

  2. Resta la cantidad de instancias en ejecución que coinciden y las reservas sin usar del recuento total en la solicitud.

Puedes determinar la cantidad de instancias consumibles para una o varias solicitudes a la vez. Para varias solicitudes, usa la consola de Google Cloud o la API de REST. Para solicitudes individuales, selecciona cualquiera de las siguientes opciones:

Console

  1. En la consola de Google Cloud, ve a la página Reservas.

    Ir a Reservas

  2. Haz clic en la pestaña Reservas futuras.

    En la tabla, se enumera cada solicitud de reserva futura y cada columna de la tabla describe una propiedad.

  3. Para determinar la cantidad de instancias que Compute Engine planea reservar para una solicitud en su hora de inicio, resta la columna Cantidad coincidente de la columna Cantidad total.

    La columna Cantidad de coincidencias muestra una de las siguientes advertencias:

    • El recuento de coincidencias es cero: No hay instancias en ejecución ni reservas sin usar que coincidan en tu proyecto ni en ningún proyecto con el que se comparta tu solicitud.

    • Cantidad de coincidencias igual a la cantidad total: Compute Engine no reservará ninguna instancia para tu solicitud a la hora de inicio.

    Si modificas una solicitud, o creas instancias o reservas nuevas que coincidan con la solicitud, Compute Engine actualiza la columna Cantidad de coincidencias en un plazo de 30 minutos.

  4. Opcional: Para verificar cuándo se actualizó por última vez la columna Matching count en una solicitud, haz lo siguiente:

    1. En la columna Nombre, haz clic en el nombre de la solicitud.

      Se abrirá una página que muestra los detalles de la solicitud de reserva futura.

    2. En la sección Detalles del recurso, revisa el campo Hora de la última evaluación de uso coincidente.

gcloud

  1. Para ver los detalles de una solicitud de reserva futura, usa el comando gcloud beta compute future-reservations describe:

    gcloud beta compute future-reservations describe FUTURE_RESERVATION_NAME \
        --zone=ZONE
    

    Reemplaza lo siguiente:

    • FUTURE_RESERVATION_NAME: El nombre de una solicitud de reserva futura existente.

    • ZONE: Es la zona en la que existe la solicitud de reserva futura.

    En el resultado, busca los campos count y totalCount:

    ...
    specificSkuProperties:
      ...
      totalCount: '100'
    status:
      existingMatchingUsageInfo:
        count: '50'
        timestamp: '2025-03-30T01:00:00Z'
      ...
      procurementStatus: DRAFTING
    ...
    
  2. Resta el valor de count de totalCount. Por ejemplo, si count es 50 y totalCount es 100, Compute Engine crea automáticamente una reserva para 50 instancias a la hora de inicio de la solicitud.

    Si modificas la solicitud, o creas instancias o reservas nuevas que coincidan con la solicitud, Compute Engine actualizará el campo existingMatchingUsageInfo en un plazo de 30 minutos. Para verificar cuándo se actualizó este campo por última vez, verifica el valor de existingMatchingUsageInfo.timestamp.

REST

  1. Para ver una lista de tus solicitudes de reserva futuras, realiza una solicitud GET al método futureReservations.list beta. En la URL de la solicitud, incluye el parámetro de consulta filter y especifica que se muestren solo los campos name, specificSkuProperties y status:

    GET https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/zones/ZONE/futureReservations?fields=items.name,items.specificSkuProperties,items.status
    

    Reemplaza lo siguiente:

    • PROJECT_ID: El ID del proyecto en el que creaste tus solicitudes de reserva futuras.

    • ZONE: Es la zona en la que existe la solicitud de reserva futura.

    En el resultado, busca los campos count y totalCount para cada borrador, solicitud pendiente de aprobación o solicitud aprobada:

    {
      "items": [
        {
          "specificSkuProperties": {
            ...
            totalCount: "100"
          },
          "name": "fr-01",
          "status": {
            "procurementStatus": "APPROVED",
            ...
            existingMatchingUsageInfo: {
              count: "50",
              "timestamp": "2025-01-22T07:54:26.295Z"
            }
          }
        },
        {
          "specificSkuProperties": {
            ...
            totalCount: "20"
          },
          "name": "fr-02",
          "status": {
            "procurementStatus": "DRAFTING",
            ...
            existingMatchingUsageInfo: {
              "count": "2",
              "timestamp": "2025-01-22T07:54:26.295Z"
            }
          }
        }
      ]
    }
    
  2. Para cada solicitud, resta el valor de count de totalCount. Por ejemplo, si count es 50 y totalCount es 100, entonces Compute Engine crea automáticamente una reserva para 50 instancias a la hora de inicio de la solicitud.

    Si modificas una solicitud, o creas instancias o reservas nuevas que coincidan con la solicitud, Compute Engine actualizará el campo existingMatchingUsageInfo en un plazo de 30 minutos. Para verificar cuándo se actualizó este campo por última vez, verifica el valor de existingMatchingUsageInfo.timestamp.

¿Qué sigue?