Melihat pemesanan atau permintaan pemesanan untuk masa mendatang

Dokumen ini menjelaskan cara melihat pemesanan, permintaan pemesanan untuk masa mendatang, dan pemakaian pemesanan. Untuk mempelajari lebih lanjut pemesanan, lihat Memilih jenis pemesanan.

Saat melihat pemesanan, permintaan pemesanan untuk masa mendatang, atau penggunaan pemesanan, Anda dapat melakukan hal berikut:

  • Melihat setelan reservasi. Peninjauan ini membantu Anda memverifikasi detail pemesanan, memastikan bahwa pemesanan tersebut memenuhi kebutuhan Anda, dan merencanakan kapasitas.

  • Tentukan jumlah instance yang dapat digunakan. Pemeriksaan ini membantu Anda menentukan jumlah instance Compute Engine yang dapat menggunakan kapasitas yang dipesan.

  • Melihat pemakaian pemesanan. Peninjauan ini memungkinkan Anda memverifikasi reservasi mana yang digunakan oleh instance Compute Engine tertentu, atau mencantumkan semua instance yang menggunakan reservasi tertentu dalam sebuah project.

Batasan

Anda hanya dapat melihat permintaan pemesanan bersama atau permintaan pemesanan untuk masa mendatang bersama di project tempat Anda membuatnya.

Sebelum memulai

Peran yang diperlukan

Untuk mendapatkan izin yang diperlukan untuk melihat pemesanan atau permintaan pemesanan untuk masa mendatang, minta administrator untuk memberi Anda peran IAM Compute Admin (roles/compute.admin) pada project. Untuk mengetahui informasi selengkapnya tentang cara memberikan peran, lihat Mengelola akses ke project, folder, dan organisasi.

Peran yang telah ditentukan ini berisi izin yang diperlukan untuk melihat pemesanan atau permintaan pemesanan untuk masa mendatang. Untuk melihat izin yang benar-benar diperlukan, perluas bagian Izin yang diperlukan:

Izin yang diperlukan

Izin berikut diperlukan untuk melihat pemesanan atau permintaan pemesanan untuk masa mendatang:

  • Untuk melihat daftar pemesanan: compute.reservations.list pada project
  • Untuk melihat daftar permintaan pemesanan untuk masa mendatang: compute.futureReservations.list pada project
  • Untuk melihat detail pemesanan: compute.reservations.get pada project
  • Untuk melihat detail permintaan pemesanan untuk masa mendatang: compute.futureReservations.get pada project

Anda mungkin juga bisa mendapatkan izin ini dengan peran khusus atau peran bawaan lainnya.

Melihat setelan reservasi

Bagian berikut menjelaskan cara melihat setelan pemesanan atau permintaan pemesanan untuk masa mendatang.

Melihat pemesanan

Untuk melihat setelan satu atau beberapa pemesanan, gunakan salah satu metode berikut yang dijelaskan di bagian ini:

  • Untuk melihat ringkasan semua reservasi dalam project Anda, lihat daftar reservasi Anda.

  • Untuk melihat detail lengkap dari satu pemesanan, lihat detail pemesanan.

Untuk melihat kolom deleteAtTime dan reservationSharingPolicy (Pratinjau) dalam pemesanan, lihat detail pemesanan menggunakan Google Cloud CLI, atau lihat pemesanan menggunakan REST API. Jika Anda tidak memerlukan kolom ini, lihat pemesanan dengan memilih salah satu opsi berikut:

Konsol

  1. Di konsol Cloud de Confiance , buka halaman Reservations.

    Buka Reservations

    Di tab On-demand reservations (default), tabel mencantumkan setiap pemesanan on-demand, dan setiap kolom tabel mendeskripsikan properti.

  2. Opsional: Di tabel pemesanan on-demand, lakukan salah satu atau kedua hal berikut:

    • Untuk menampilkan jumlah yang dijamin dari pemesanan Anda, klik Opsi tampilan kolom..., centang kotak Jumlah yang dijamin, lalu klik Oke.

    • Untuk menyaring daftar pemesanan, di kolom Filter, pilih properti yang ingin Anda gunakan untuk memfilter pemesanan.

  3. Untuk melihat detail pemesanan, di kolom Nama, klik nama pemesanan. Halaman yang memberikan detail pemesanan akan terbuka.

gcloud

  • Untuk melihat daftar pemesanan, gunakan perintah gcloud compute reservations list:

    gcloud compute reservations list
    

    Outputnya mirip dengan contoh berikut:

    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
    

    Atau, untuk menyaring daftar pemesanan menggunakan ekspresi filter, sertakan flag --filter:

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

    Ganti FILTER_EXPRESSION dengan ekspresi filter.

  • Untuk melihat detail pemesanan, gunakan perintah gcloud compute reservations describe:

    gcloud compute reservations describe RESERVATION_NAME \
        --zone=ZONE
    

    Ganti kode berikut:

    • RESERVATION_NAME: nama pemesanan yang ada.

    • ZONE: zona tempat pemesanan berada.

    Outputnya mirip dengan contoh berikut:

    creationTimestamp: '2024-10-11T03:25:23.192-07:00'
    id: '4488228526648280060'
    kind: compute#reservation
    name: r-01
    selfLink: https://www.s3nsapis.fr/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.s3nsapis.fr/compute/v1/projects/my-project/zones/us-central1-a
    

Go

  • Untuk melihat daftar pemesanan, gunakan contoh kode berikut:

    // 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
    }
    
    
  • Untuk melihat detail pemesanan, gunakan contoh kode berikut:

    // 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

  • Untuk melihat daftar pemesanan, gunakan contoh kode berikut:

    /*
     * 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;
      }
    }
  • Untuk melihat detail pemesanan, gunakan contoh kode berikut:

    /*
     * 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

  • Untuk melihat daftar pemesanan, gunakan contoh kode berikut:

    /*
     * 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;
    });
    
  • Untuk melihat detail pemesanan, gunakan contoh kode berikut:

    /*
     * 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

  • Untuk melihat daftar pemesanan, gunakan contoh kode berikut:

    # 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
    
    
    
  • Untuk melihat detail pemesanan, gunakan contoh kode berikut:

    # 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

  • Untuk melihat daftar pemesanan Anda, buat permintaan GET ke metode reservations.list:

    GET https://compute.s3nsapis.fr/compute/v1/projects/PROJECT_ID/zones/ZONE/reservations
    

    Ganti kode berikut:

    • PROJECT_ID: ID project tempat Anda membuat pemesanan.

    • ZONE: zona tempat pemesanan Anda berada.

    Outputnya mirip dengan contoh berikut:

    {
      "kind": "compute#reservation",
      "id": "4100668622331754141",
      "creationTimestamp": "2019-09-27T08:21:14.707-07:00",
      "selfLink": "https://www.s3nsapis.fr/compute/v1/projects/my-project/zones/us-central1-a/reservations/reservation-05",
      "zone": "https://www.s3nsapis.fr/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.s3nsapis.fr/compute/v1/projects/my-project/zones/us-central1-a/reservations/reservation-04",
      "zone": "https://www.s3nsapis.fr/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"
      }
    }
    

    Atau, untuk mempersempit daftar pemesanan menggunakan ekspresi filter, sertakan parameter kueri filter:

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

    Ganti FILTER_EXPRESSION dengan ekspresi filter yang menggunakan nilai berenkode URL.

  • Untuk melihat detail pemesanan, buat permintaan GET ke metode reservations.get.

    GET https://compute.s3nsapis.fr/compute/v1/projects/PROJECT_ID/zones/ZONE/reservations/RESERVATION_NAME
    

    Ganti kode berikut:

    • PROJECT_ID: ID project tempat Anda membuat pemesanan.

    • ZONE: zona tempat pemesanan berada.

    • RESERVATION_NAME: nama pemesanan yang ada.

    Outputnya mirip dengan contoh berikut:

    {
      "kind": "compute#reservation",
      "id": "4488228526648280060",
      "creationTimestamp": "2024-10-11T03:25:23.192-07:00",
      "selfLink": "https://www.s3nsapis.fr/compute/v1/projects/davide-experimental/zones/us-central1-a/reservations/r-01",
      "zone": "https://www.s3nsapis.fr/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"
      }
    }
    

Melihat permintaan pemesanan untuk masa mendatang

Untuk melihat setelan satu atau beberapa permintaan pemesanan untuk masa mendatang, gunakan salah satu metode berikut yang dijelaskan di bagian ini:

  • Untuk melihat ringkasan semua permintaan pemesanan untuk masa mendatang dalam project Anda, lihat daftar permintaan Anda.

  • Untuk melihat detail lengkap satu permintaan pemesanan untuk masa mendatang, lihat detail permintaan.

Untuk melihat permintaan pemesanan untuk masa mendatang, pilih salah satu opsi berikut:

Konsol

  1. Di konsol Cloud de Confiance , buka halaman Reservations.

    Buka Reservations

  2. Klik tab Pemesanan untuk masa mendatang.

    Tabel ini mencantumkan setiap permintaan pemesanan untuk masa mendatang, dan setiap kolom tabel menjelaskan properti.

  3. Opsional: Untuk menyaring daftar permintaan, di kolom Filter, pilih properti yang ingin Anda gunakan untuk memfilter permintaan.

  4. Untuk melihat detail permintaan, di kolom Nama, klik nama permintaan. Halaman yang memberikan detail permintaan pemesanan untuk masa mendatang akan terbuka.

gcloud

  • Untuk melihat daftar permintaan pemesanan untuk masa mendatang, gunakan perintah gcloud compute future-reservations list:

    gcloud compute future-reservations list
    

    Outputnya mirip dengan contoh berikut:

    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
    

    Atau, untuk menyaring daftar permintaan pemesanan untuk masa mendatang menggunakan ekspresi filter, sertakan flag --filter:

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

    Ganti FILTER_EXPRESSION dengan ekspresi filter.

  • Untuk melihat detail permintaan pemesanan untuk masa mendatang, gunakan perintah gcloud compute future-reservations describe:

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

    Ganti kode berikut:

    • FUTURE_RESERVATION_NAME: nama permintaan pemesanan untuk masa mendatang yang ada.

    • ZONE: zona tempat permintaan pemesanan untuk masa mendatang berada.

    Outputnya mirip dengan contoh berikut:

    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.s3nsapis.fr/compute/v1/projects/example-project/zones/us-central1-a/futureReservations/fr-01
    selfLinkWithId: https://www.s3nsapis.fr/compute/v1/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.s3nsapis.fr/compute/v1/projects/example-project/zones/us-central1-a
    

REST

  • Untuk melihat daftar permintaan pemesanan untuk masa mendatang, buat permintaan GET ke metode futureReservations.list:

    GET https://compute.s3nsapis.fr/compute/v1/projects/PROJECT_ID/zones/ZONE/futureReservations
    

    Ganti kode berikut:

    • PROJECT_ID: ID project tempat Anda membuat permintaan pemesanan untuk masa mendatang.

    • ZONE: zona tempat permintaan pemesanan untuk masa mendatang Anda berada.

    Outputnya mirip dengan contoh berikut:

    {
      "id": "projects/my-project/zones/us-east1-a/futureReservations",
      "items": [
        {
          "id": "743865190848184978",
          "creationTimestamp": "2025-03-23T18:16:45.274-07:00",
          "selfLink": "https://www.s3nsapis.fr/compute/v1/projects/my-project/zones/us-east1-a/futureReservations/fr-base",
          "selfLinkWithId": "https://www.s3nsapis.fr/compute/v1/projects/my-project/zones/us-east1-a/futureReservations/743865190848184978",
          "zone": "https://www.s3nsapis.fr/compute/v1/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.s3nsapis.fr/compute/v1/projects/my-project/zones/us-east1-a/futureReservations",
      "etag": "AnzKY34l-cvvV-JnniESJ0dtQvQ=/hvc4jaHpxFAZmOt1FVtKNgzZu-M=",
      "kind": "compute#futureReservationsListResponse"
    }
    

    Atau, untuk mempersempit daftar permintaan pemesanan untuk masa mendatang menggunakan ekspresi filter, sertakan parameter kueri filter:

    GET https://compute.s3nsapis.fr/compute/v1/projects/PROJECT_ID/aggregated/futureReservations?filter=FILTER_EXPRESSION
    

    Ganti FILTER_EXPRESSION dengan ekspresi filter yang menggunakan nilai berenkode URL.

  • Untuk melihat detail permintaan pemesanan untuk masa mendatang, buat permintaan GET ke metode futureReservations.get:

    GET https://compute.s3nsapis.fr/compute/v1/projects/PROJECT_ID/zones/ZONE/futureReservations/FUTURE_RESERVATION_NAME
    

    Ganti kode berikut:

    • PROJECT_ID: ID project tempat Anda membuat permintaan pemesanan untuk masa mendatang.

    • ZONE: zona tempat permintaan pemesanan untuk masa mendatang berada.

    • FUTURE_RESERVATION_NAME: nama permintaan pemesanan untuk masa mendatang yang ada.

    Outputnya mirip dengan hal berikut ini:

    {
      "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.s3nsapis.fr/compute/v1/projects/example-project/zones/us-central1-a/futureReservations/fr-01",
      "selfLinkWithId": "https://www.s3nsapis.fr/compute/v1/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.s3nsapis.fr/compute/v1/projects/example-project/zones/us-central1-a"
    }
    

Menentukan jumlah instance yang dapat digunakan

Untuk menentukan jumlah instance komputasi yang dapat menggunakan kapasitas yang Anda pesan, lakukan salah satu hal berikut:

Instance yang dapat digunakan dalam pemesanan

Saat melihat detail pemesanan, Anda dapat melihat jumlah instance komputasi yang memakai pemesanan, dan jumlah instance yang dapat memakainya, dengan memeriksa kolom berikut:

  • Assured count (assuredCount): jumlah instance yang dicadangkan secara fisik dalam zona pemesanan. Jumlah ini mencakup instance yang dicadangkan untuk project Anda, dan untuk project yang menggunakan bersama pemesanan bersama.

  • Jumlah total (count): jumlah reserved instance yang ditentukan dalam pemesanan. Jumlah ini harus sesuai dengan jumlah yang dijamin.

  • Mesin yang digunakan (inUseCount): jumlah instance yang berjalan di project Anda, atau project yang menggunakan pemesanan bersama, yang menggunakan pemesanan tersebut.

Misalnya, jika jumlah yang dijamin (assuredCount) dan jumlah total (count) keduanya adalah 50, dan jumlah instance yang menggunakan reservasi (inUseCount) adalah 25, maka 25 instance lagi dapat menggunakan reservasi sebelum reservasi tersebut digunakan sepenuhnya.

Instance yang dapat digunakan dalam permintaan pemesanan untuk masa mendatang

Anda dapat menentukan jumlah instance komputasi yang direncanakan Compute Engine untuk dipesan pada waktu mulai permintaan pemesanan untuk masa mendatang draf, tertunda, atau disetujui.

Jumlah ini bergantung pada afinitas pemesanan permintaan Anda:

  • Pemesanan yang otomatis digunakan: untuk menentukan jumlah ini, lakukan hal berikut:

    1. Melihat jumlah instance yang berjalan dan pemesanan yang tidak digunakan dalam project dan project konsumen Anda yang cocok dengan properti permintaan.

    2. Kurangi jumlah kecocokan tersebut dari jumlah total dalam permintaan.

  • Pemesanan yang ditargetkan secara khusus: jumlah ini sama dengan jumlah total dalam permintaan pemesanan untuk masa mendatang. Compute Engine tidak mengurangi pemesanan yang ada atau VM aktif.

Anda dapat menentukan jumlah instance yang dapat digunakan untuk satu atau beberapa permintaan sekaligus. Untuk beberapa permintaan, gunakan konsol Cloud de Confiance atau REST API. Untuk permintaan tunggal, pilih salah satu opsi berikut:

Konsol

  1. Di konsol Cloud de Confiance , buka halaman Reservations.

    Buka Reservations

  2. Klik tab Pemesanan untuk masa mendatang. Tabel ini mencantumkan setiap permintaan pemesanan untuk masa mendatang, dan setiap kolom tabel mendeskripsikan properti.

  3. Untuk menentukan jumlah instance komputasi yang direncanakan Compute Engine untuk dipesan pada waktu mulai, lakukan salah satu hal berikut:

    • Permintaan yang otomatis digunakan: kurangi kolom Jumlah yang cocok dari kolom Jumlah total. Berdasarkan jumlah total, kolom Jumlah yang cocok menampilkan salah satu peringatan berikut:

      • Jumlah kecocokan adalah nol: tidak ada instance yang berjalan atau pemesanan yang tidak digunakan yang cocok di project Anda, atau di project mana pun yang dibagikan dengan permintaan Anda.

      • Jumlah yang cocok sama dengan Jumlah total: Compute Engine tidak akan memesan instance apa pun untuk permintaan Anda pada waktu mulainya.

      Jika Anda mengubah permintaan, atau membuat instance atau pemesanan baru yang cocok dengan permintaan, Compute Engine akan memperbarui kolom Jumlah yang cocok dalam waktu 30 menit.

    • Pemesanan yang ditargetkan secara khusus: periksa kolom Total count. Compute Engine menyediakan jumlah penuh ini.

  4. Opsional: Untuk memeriksa kapan kolom Jumlah yang cocok terakhir diperbarui dalam permintaan, lakukan hal berikut:

    1. Di kolom Name, klik nama permintaan. Halaman yang memberikan detail permintaan pemesanan untuk masa mendatang akan terbuka.

    2. Di bagian Resource details, periksa kolom Last matching usage evaluation time.

gcloud

  1. Untuk melihat detail permintaan pemesanan untuk masa mendatang, gunakan perintah gcloud compute future-reservations describe:

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

    Ganti kode berikut:

    • FUTURE_RESERVATION_NAME: nama permintaan pemesanan untuk masa mendatang yang ada.

    • ZONE: zona tempat permintaan pemesanan untuk masa mendatang berada.

    Dalam output, temukan kolom count dan totalCount:

    ...
    specificSkuProperties:
      ...
      totalCount: '100'
    status:
      existingMatchingUsageInfo:
        count: '50'
        timestamp: '2025-03-30T01:00:00Z'
      ...
      procurementStatus: DRAFTING
    ...
    
  2. Tentukan jumlah instance yang dapat digunakan yang direncanakan Compute Engine untuk dipesan pada waktu mulai permintaan berdasarkan afinitas pemesanan:

    • Permintaan yang otomatis digunakan: kurangi count dari totalCount. Misalnya, jika count adalah 50 dan totalCount adalah 100, Compute Engine akan merencanakan untuk memesan 50 instance komputasi pada waktu mulai. Jika Anda mengubah permintaan, atau membuat instance atau pemesanan baru yang cocok dengan permintaan, Compute Engine akan memperbarui kolom existingMatchingUsageInfo dalam waktu 30 menit. Untuk memverifikasi kapan kolom ini terakhir diperbarui, periksa nilai existingMatchingUsageInfo.timestamp.

    • Pemesanan yang ditargetkan secara khusus: Compute Engine berencana untuk mencadangkan nilai yang ditentukan di kolom totalCount pada waktu mulai permintaan.

REST

  1. Untuk melihat daftar permintaan pemesanan untuk masa mendatang, buat permintaan GET ke metode futureReservations.list. Dalam URL permintaan, sertakan parameter kueri filter dan tentukan untuk hanya menampilkan kolom name, specificSkuProperties, dan status:

    GET https://compute.s3nsapis.fr/compute/v1/projects/PROJECT_ID/zones/ZONE/futureReservations?fields=items.name,items.specificSkuProperties,items.status
    

    Ganti kode berikut:

    • PROJECT_ID: ID project tempat Anda membuat permintaan pemesanan untuk masa mendatang.

    • ZONE: zona tempat permintaan pemesanan untuk masa mendatang berada.

    Dalam output, temukan kolom count dan totalCount untuk setiap draf, permintaan yang menunggu persetujuan, atau permintaan yang disetujui:

    {
      "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. Tentukan jumlah instance yang dapat digunakan yang direncanakan Compute Engine untuk dipesan pada waktu mulai permintaan berdasarkan afinitas pemesanan:

    • Permintaan yang digunakan secara otomatis: kurangi count dari totalCount. Misalnya, jika count adalah 50 dan totalCount adalah 100, Compute Engine akan merencanakan untuk memesan 50 instance komputasi pada waktu mulai. Jika Anda mengubah permintaan, atau membuat instance atau pemesanan baru yang cocok dengan permintaan, Compute Engine akan memperbarui kolom existingMatchingUsageInfo dalam waktu 30 menit. Untuk memverifikasi kapan kolom ini terakhir diperbarui, periksa nilai existingMatchingUsageInfo.timestamp.

    • Pemesanan yang ditargetkan secara khusus: Compute Engine berencana untuk memesan nilai yang ditentukan dalam kolom totalCount pada waktu mulai permintaan.

Instance yang dapat digunakan dalam permintaan pemesanan untuk masa mendatang dalam mode kalender

Saat melihat detail permintaan pemesanan untuk masa mendatang, Anda dapat melihat jumlah instance komputasi yang direncanakan Compute Engine untuk disediakan pada waktu mulai permintaan. Compute Engine membuat jumlah instance yang ditentukan dalam permintaan, terlepas dari jumlah instance yang cocok dalam project Anda atau dalam project mana pun yang dibagikan dengan permintaan tersebut.

Melihat pemakaian pemesanan

Setiap kali instance komputasi menggunakan reservasi, Anda dapat melihat hal berikut:

Melihat pemesanan yang digunakan instance

Untuk melihat pemesanan yang digunakan instance, pilih salah satu opsi berikut:

Konsol

  1. Di konsol Cloud de Confiance , buka halaman VM instances.

    Buka instance VM

  2. Klik nama instance yang menggunakan pemesanan yang ingin Anda lihat.

  3. Di bagian Basic information, kolom Consumed reservation menampilkan nama pemesanan yang digunakan oleh instance.

gcloud

Untuk melihat pemesanan yang digunakan instance, gunakan perintah gcloud compute instances describe dengan flag --flatten=resourceStatus.reservationConsumptionInfo:

gcloud compute instances describe INSTANCE_NAME \
    --flatten=resourceStatus.reservationConsumptionInfo \
    --zone=ZONE

Ganti kode berikut:

  • INSTANCE_NAME: nama instance.
  • ZONE: zona tempat instance berada.

Anda akan melihat output yang mirip dengan berikut ini:

consumedReservation: https://www.googleapis.com/compute/v1/projects/example-project/zones/us-central1-c/reservations/example-reservation

REST

Untuk melihat pemesanan yang digunakan instance, buat permintaan GET ke metode instances.get. Dalam URL permintaan, sertakan parameter kueri fields yang ditetapkan ke resourceStatus.reservationConsumptionInfo:

GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME?fields=resourceStatus.reservationConsumptionInfo

Ganti kode berikut:

  • PROJECT_ID: ID project tempat instance berada.
  • ZONE: zona tempat instance berada.
  • INSTANCE_NAME: nama instance.

Anda akan melihat respons yang mirip dengan berikut ini:

{
  "resourceStatus": {
    "reservationConsumptionInfo": {
      "consumedReservation": "https://www.googleapis.com/compute/v1/projects/example-project/zones/us-central1-a/reservations/example-reservation"
    }
  }
}

Melihat daftar instance yang menggunakan reservasi

Anda dapat melihat daftar instance yang menggunakan pemesanan dalam satu project. Untuk pemesanan bersama, metode ini hanya menampilkan instance dalam project yang Anda tentukan; metode ini tidak menyertakan instance dari project konsumen lain yang menggunakan pemesanan yang sama.

Untuk melihat instance yang menggunakan reservasi, pilih salah satu opsi berikut:

gcloud

Untuk melihat instance yang menggunakan pemesanan, gunakan perintah gcloud compute instances list dengan flag --filter yang ditetapkan ke pemesanan yang ingin Anda lihat:

gcloud compute instances list \
    --project=CONSUMER_PROJECT_ID \
    --zones=ZONE \
    --filter="resourceStatus.reservationConsumptionInfo.consumedReservation:https://www.googleapis.com/compute/v1/projects/HOST_PROJECT_ID/zones/ZONE/reservations/RESERVATION_NAME"

Ganti kode berikut:

  • CONSUMER_PROJECT_ID: ID project yang menggunakan pemesanan.
  • ZONE: zona tempat pemesanan dan instance berada.
  • HOST_PROJECT_ID: ID project tempat pemesanan dibuat (jika berbeda dengan project konsumen).
  • RESERVATION_NAME: nama pemesanan.

Anda akan melihat output yang mirip dengan berikut ini:

NAME               ZONE           MACHINE_TYPE  PREEMPTIBLE  INTERNAL_IP  EXTERNAL_IP     STATUS
my-e2-instance     us-central1-c  e2-medium                  10.128.0.61  35.239.208.172  RUNNING
my-e2-instance-02  us-central1-c  e2-medium                  10.128.0.62  104.154.31.123  RUNNING
my-e2-instance-03  us-central1-c  e2-medium                  10.128.0.63  34.171.90.254   RUNNING

REST

Untuk melihat instance yang menggunakan pemesanan, buat permintaan GET ke metode instances.list. Dalam URL permintaan, sertakan parameter kueri filter yang ditetapkan ke nama pemesanan yang ingin Anda lihat:

GET https://compute.googleapis.com/compute/v1/projects/CONSUMER_PROJECT_ID/zones/ZONE/instances?filter=resourceStatus.reservationConsumptionInfo.consumedReservation%3D%22.*%2Fprojects%2FHOST_PROJECT_ID%2Fzones%2FZONE%2Freservations%2FRESERVATION_NAME%22

Ganti kode berikut:

  • CONSUMER_PROJECT_ID: ID project yang menggunakan pemesanan.
  • ZONE: zona tempat pemesanan dan instance berada.
  • HOST_PROJECT_ID: ID project tempat pemesanan dibuat (jika berbeda dengan project konsumen).
  • RESERVATION_NAME: nama pemesanan.

Anda akan melihat respons yang mirip dengan berikut ini:

{
  "kind": "compute#instanceList",
  "id": "projects/example-project/zones/us-central1-a/instances",
  "items": [
    {
      ...
      "name": "example-instance-01",
      ...
      "resourceStatus": {
        "scheduling": {},
        "reservationConsumptionInfo": {
          "consumedReservation": "https://www.googleapis.com/compute/v1/projects/example-project/zones/us-central1-a/reservations/example-reservation"
        }
      }
    },
    {
      ...
      "name": "example-instance-02",
      ...
      "resourceStatus": {
        "scheduling": {},
        "reservationConsumptionInfo": {
          "consumedReservation": "https://www.googleapis.com/compute/v1/projects/example-project/zones/us-central1-a/reservations/example-reservation"
        }
      },
      ...
    }
  ],
  "selfLink": "https://www.googleapis.com/compute/v1/projects/example-project/zones/us-central1-a/instances"
}

Langkah berikutnya