์˜ˆ์•ฝ ๋˜๋Š” ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ ๋ณด๊ธฐ


์ด ๋ฌธ์„œ์—์„œ๋Š” ์˜ˆ์•ฝ ๋˜๋Š” ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์„ ํ™•์ธํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์„ค๋ช…ํ•ฉ๋‹ˆ๋‹ค. ๋‹ค์–‘ํ•œ ์œ ํ˜•์˜ ์˜ˆ์•ฝ์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์•Œ์•„๋ณด๋ ค๋ฉด ์˜ˆ์•ฝ ์œ ํ˜• ์„ ํƒ์„ ์ฐธ์กฐํ•˜์„ธ์š”.

์˜ˆ์•ฝ ๋˜๋Š” ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์„ ๋ณด๋ฉด ๋‹ค์Œ์„ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • ์˜ˆ์•ฝ ์„ค์ • ๋ณด๊ธฐ. ์ด๋Ÿฌํ•œ ๊ฒ€ํ†  ์ž‘์—…์€ ์˜ˆ์•ฝ ์„ธ๋ถ€์ •๋ณด๋ฅผ ํ™•์ธํ•˜๊ณ , ์š”๊ตฌ๋ฅผ ์ถฉ์กฑํ•˜๋Š”์ง€ ํ™•์ธํ•˜๊ณ , ์šฉ๋Ÿ‰์„ ๊ณ„ํšํ•˜๋Š” ๋ฐ ๋„์›€์ด ๋ฉ๋‹ˆ๋‹ค.

  • ์†Œ๋น„ ๊ฐ€๋Šฅํ•œ ์ธ์Šคํ„ด์Šค ์ˆ˜ ๊ฒฐ์ •. ์ด๋Ÿฌํ•œ ํ™•์ธ ์ž‘์—…์€ ์˜ˆ์•ฝ๋œ ์šฉ๋Ÿ‰์„ ์†Œ๋น„ํ•  ์ˆ˜ ์žˆ๋Š” Compute Engine ์ธ์Šคํ„ด์Šค ์ˆ˜๋ฅผ ๊ฒฐ์ •ํ•˜๋Š” ๋ฐ ๋„์›€์ด ๋ฉ๋‹ˆ๋‹ค.

์ œํ•œ์‚ฌํ•ญ

์‚ฌ์šฉ์ž๊ฐ€ ๋งŒ๋“  ํ”„๋กœ์ ํŠธ์—์„œ๋งŒ ๊ณต์œ  ์˜ˆ์•ฝ ๋˜๋Š” ๊ณต์œ  ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์„ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์‹œ์ž‘ํ•˜๊ธฐ ์ „์—

  • ์•„์ง ์ธ์ฆ์„ ์„ค์ •ํ•˜์ง€ ์•Š์•˜๋‹ค๋ฉด ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. ์ธ์ฆ์€ Google Cloud ์„œ๋น„์Šค ๋ฐ API์— ์•ก์„ธ์Šคํ•˜๊ธฐ ์œ„ํ•ด ID๋ฅผ ํ™•์ธํ•˜๋Š” ํ”„๋กœ์„ธ์Šค์ž…๋‹ˆ๋‹ค. ๋กœ์ปฌ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์—์„œ ์ฝ”๋“œ ๋˜๋Š” ์ƒ˜ํ”Œ์„ ์‹คํ–‰ํ•˜๋ ค๋ฉด ๋‹ค์Œ ์˜ต์…˜ ์ค‘ ํ•˜๋‚˜๋ฅผ ์„ ํƒํ•˜์—ฌ Compute Engine์— ์ธ์ฆํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค.

    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. After installing the Google Cloud CLI, initialize it by running the following command:

      gcloud init

      If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

    2. Set a default region and zone.
    3. Go

      ๋กœ์ปฌ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์—์„œ ์ด ํŽ˜์ด์ง€์˜ Go ์ƒ˜ํ”Œ์„ ์‚ฌ์šฉํ•˜๋ ค๋ฉด gcloud CLI๋ฅผ ์„ค์น˜ ๋ฐ ์ดˆ๊ธฐํ™”ํ•œ ๋‹ค์Œ ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด๋กœ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ธฐ๋ณธ ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด๋ฅผ ์„ค์ •ํ•˜์„ธ์š”.

      1. Install the Google Cloud CLI.

      2. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

      3. To initialize the gcloud CLI, run the following command:

        gcloud init
      4. 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.

        If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.

      5. ์ž์„ธํ•œ ๋‚ด์šฉ์€ ๋‹ค์Œ์„ ์ฐธ์กฐํ•˜์„ธ์š”: Set up authentication for a local development environment.

      Java

      ๋กœ์ปฌ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์—์„œ ์ด ํŽ˜์ด์ง€์˜ Java ์ƒ˜ํ”Œ์„ ์‚ฌ์šฉํ•˜๋ ค๋ฉด gcloud CLI๋ฅผ ์„ค์น˜ ๋ฐ ์ดˆ๊ธฐํ™”ํ•œ ๋‹ค์Œ ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด๋กœ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ธฐ๋ณธ ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด๋ฅผ ์„ค์ •ํ•˜์„ธ์š”.

      1. Install the Google Cloud CLI.

      2. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

      3. To initialize the gcloud CLI, run the following command:

        gcloud init
      4. 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.

        If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.

      5. ์ž์„ธํ•œ ๋‚ด์šฉ์€ ๋‹ค์Œ์„ ์ฐธ์กฐํ•˜์„ธ์š”: Set up authentication for a local development environment.

      Node.js

      ๋กœ์ปฌ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์—์„œ ์ด ํŽ˜์ด์ง€์˜ Node.js ์ƒ˜ํ”Œ์„ ์‚ฌ์šฉํ•˜๋ ค๋ฉด gcloud CLI๋ฅผ ์„ค์น˜ ๋ฐ ์ดˆ๊ธฐํ™”ํ•œ ๋‹ค์Œ ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด๋กœ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ธฐ๋ณธ ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด๋ฅผ ์„ค์ •ํ•˜์„ธ์š”.

      1. Install the Google Cloud CLI.

      2. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

      3. To initialize the gcloud CLI, run the following command:

        gcloud init
      4. 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.

        If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.

      5. ์ž์„ธํ•œ ๋‚ด์šฉ์€ ๋‹ค์Œ์„ ์ฐธ์กฐํ•˜์„ธ์š”: Set up authentication for a local development environment.

      Python

      ๋กœ์ปฌ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์—์„œ ์ด ํŽ˜์ด์ง€์˜ Python ์ƒ˜ํ”Œ์„ ์‚ฌ์šฉํ•˜๋ ค๋ฉด gcloud CLI๋ฅผ ์„ค์น˜ ๋ฐ ์ดˆ๊ธฐํ™”ํ•œ ๋‹ค์Œ ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด๋กœ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ธฐ๋ณธ ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด๋ฅผ ์„ค์ •ํ•˜์„ธ์š”.

      1. Install the Google Cloud CLI.

      2. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

      3. To initialize the gcloud CLI, run the following command:

        gcloud init
      4. 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.

        If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.

      5. ์ž์„ธํ•œ ๋‚ด์šฉ์€ ๋‹ค์Œ์„ ์ฐธ์กฐํ•˜์„ธ์š”: Set up authentication for a local development environment.

      REST

      ๋กœ์ปฌ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์—์„œ ์ด ํŽ˜์ด์ง€์˜ REST API ์ƒ˜ํ”Œ์„ ์‚ฌ์šฉํ•˜๋ ค๋ฉด gcloud CLI์— ์ œ๊ณตํ•œ ์‚ฌ์šฉ์ž ์ธ์ฆ ์ •๋ณด๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

        After installing the Google Cloud CLI, initialize it by running the following command:

        gcloud init

        If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

      ์ž์„ธํ•œ ๋‚ด์šฉ์€ Google Cloud ์ธ์ฆ ๋ฌธ์„œ์˜ REST ์‚ฌ์šฉ์„ ์œ„ํ•œ ์ธ์ฆ์„ ์ฐธ์กฐํ•˜์„ธ์š”.

ํ•„์š”ํ•œ ์—ญํ• 

์˜ˆ์•ฝ ๋˜๋Š” ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์„ ๋ณด๋Š” ๋ฐ ํ•„์š”ํ•œ ๊ถŒํ•œ์„ ์–ป์œผ๋ ค๋ฉด ๊ด€๋ฆฌ์ž์—๊ฒŒ ํ”„๋กœ์ ํŠธ์— ๋Œ€ํ•œ ์ปดํ“จํŒ… ๊ด€๋ฆฌ์ž(roles/compute.admin) IAM ์—ญํ• ์„ ๋ถ€์—ฌํ•ด ๋‹ฌ๋ผ๊ณ  ์š”์ฒญํ•˜์„ธ์š”. ์—ญํ•  ๋ถ€์—ฌ์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ ํ”„๋กœ์ ํŠธ, ํด๋”, ์กฐ์ง์— ๋Œ€ํ•œ ์•ก์„ธ์Šค ๊ด€๋ฆฌ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

์ด ์‚ฌ์ „ ์ •์˜๋œ ์—ญํ• ์—๋Š” ์˜ˆ์•ฝ ๋˜๋Š” ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์„ ๋ณด๋Š” ๋ฐ ํ•„์š”ํ•œ ๊ถŒํ•œ์ด ํฌํ•จ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ํ•„์š”ํ•œ ์ •ํ™•ํ•œ ๊ถŒํ•œ์„ ๋ณด๋ ค๋ฉด ํ•„์ˆ˜ ๊ถŒํ•œ ์„น์…˜์„ ํŽผ์น˜์„ธ์š”.

ํ•„์ˆ˜ ๊ถŒํ•œ

์˜ˆ์•ฝ ๋˜๋Š” ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์„ ๋ณด๋ ค๋ฉด ๋‹ค์Œ ๊ถŒํ•œ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

  • ์˜ˆ์•ฝ ๋ชฉ๋ก ๋ณด๊ธฐ: ํ”„๋กœ์ ํŠธ์— ๋Œ€ํ•œ compute.reservations.list ๊ถŒํ•œ
  • ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ ๋ชฉ๋ก ๋ณด๊ธฐ: ํ”„๋กœ์ ํŠธ์— ๋Œ€ํ•œ compute.futureReservations.list ๊ถŒํ•œ
  • ์˜ˆ์•ฝ์˜ ์„ธ๋ถ€์ •๋ณด ๋ณด๊ธฐ: ํ”„๋กœ์ ํŠธ์— ๋Œ€ํ•œ compute.reservations.get ๊ถŒํ•œ
  • ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์˜ ์„ธ๋ถ€์ •๋ณด๋ฅผ ๋ณด๋ ค๋ฉด ํ”„๋กœ์ ํŠธ์— ๋Œ€ํ•œ compute.futureReservations.get ๊ถŒํ•œ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

์ปค์Šคํ…€ ์—ญํ• ์ด๋‚˜ ๋‹ค๋ฅธ ์‚ฌ์ „ ์ •์˜๋œ ์—ญํ• ์„ ์‚ฌ์šฉํ•˜์—ฌ ์ด ๊ถŒํ•œ์„ ๋ถ€์—ฌ๋ฐ›์„ ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

์˜ˆ์•ฝ ์„ค์ • ๋ณด๊ธฐ

๋‹ค์Œ ์„น์…˜์—์„œ๋Š” ์˜ˆ์•ฝ ๋˜๋Š” ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์˜ ์„ค์ •์„ ํ™•์ธํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์„ค๋ช…ํ•ฉ๋‹ˆ๋‹ค.

์˜ˆ์•ฝ ๋ณด๊ธฐ

ํ•˜๋‚˜ ์ด์ƒ์˜ ์˜ˆ์•ฝ ์„ค์ •์„ ๋ณด๋ ค๋ฉด ์ด ์„น์…˜์— ์„ค๋ช…๋œ ๋‹ค์Œ ๋ฐฉ๋ฒ• ์ค‘ ํ•˜๋‚˜๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

  • ํ”„๋กœ์ ํŠธ์˜ ๋ชจ๋“  ์˜ˆ์•ฝ ๊ฐœ์š”๋ฅผ ๋ณด๋ ค๋ฉด ์˜ˆ์•ฝ ๋ชฉ๋ก์„ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

  • ๋‹จ์ผ ์˜ˆ์•ฝ์˜ ์ „์ฒด ์„ธ๋ถ€์ •๋ณด๋ฅผ ๋ณด๋ ค๋ฉด ์˜ˆ์•ฝ์˜ ์„ธ๋ถ€์ •๋ณด๋ฅผ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

์˜ˆ์•ฝ์—์„œ deleteAtTime ๋ฐ reservationSharingPolicy ํ•„๋“œ(๋ฏธ๋ฆฌ๋ณด๊ธฐ)๋ฅผ ๋ณด๋ ค๋ฉด Google Cloud CLI๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์˜ˆ์•ฝ ์„ธ๋ถ€์ •๋ณด๋ฅผ ๋ณด๊ฑฐ๋‚˜ REST API๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์˜ˆ์•ฝ์„ ๋ด…๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ํ•„๋“œ๊ฐ€ ํ•„์š”ํ•˜์ง€ ์•Š์œผ๋ฉด ๋‹ค์Œ ์˜ต์…˜ ์ค‘์—์„œ ์„ ํƒํ•˜์—ฌ ์˜ˆ์•ฝ์„ ๋ด…๋‹ˆ๋‹ค.

์ฝ˜์†”

  1. Google Cloud ์ฝ˜์†”์—์„œ ์˜ˆ์•ฝ ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.

    ์˜ˆ์•ฝ์œผ๋กœ ์ด๋™

    ์˜จ๋””๋งจ๋“œ ์˜ˆ์•ฝ ํƒญ(๊ธฐ๋ณธ๊ฐ’)์—์„œ ํ…Œ์ด๋ธ”์— ๊ฐ ์˜ˆ์•ฝ์ด ๋‚˜์—ด๋˜๊ณ , ๊ฐ ํ…Œ์ด๋ธ” ์—ด์— ์†์„ฑ ์„ค๋ช…์ด ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.

  2. ์„ ํƒ์‚ฌํ•ญ: ์˜จ๋””๋งจ๋“œ ์˜ˆ์•ฝ ํ…Œ์ด๋ธ”์—์„œ ๋‹ค์Œ ์ค‘ ํ•˜๋‚˜ ๋˜๋Š” ๋ชจ๋‘๋ฅผ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.

    • ์˜ˆ์•ฝ ๋ณด์žฅ๋œ ๊ฐœ์ˆ˜๋ฅผ ํ‘œ์‹œํ•˜๋ ค๋ฉด ์—ด ํ‘œ์‹œ ์˜ต์…˜...์„ ํด๋ฆญํ•˜๊ณ  ๋ณด์žฅ๋œ ์ˆ˜ ์ฒดํฌ๋ฐ•์Šค๋ฅผ ์„ ํƒํ•œ ํ›„ ํ™•์ธ์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

    • ์˜ˆ์•ฝ ๋ชฉ๋ก์„ ๋ฏธ์„ธ ์กฐ์ •ํ•˜๋ ค๋ฉด ํ•„ํ„ฐ ํ•„๋“œ์—์„œ ์˜ˆ์•ฝ์„ ํ•„ํ„ฐ๋งํ•˜๋ ค๋Š” ์†์„ฑ์„ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

  3. ์˜ˆ์•ฝ์˜ ์„ธ๋ถ€์ •๋ณด๋ฅผ ๋ณด๋ ค๋ฉด ์ด๋ฆ„ ์—ด์—์„œ ์˜ˆ์•ฝ ์ด๋ฆ„์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ์•ฝ ์„ธ๋ถ€์ •๋ณด๋ฅผ ์ œ๊ณตํ•˜๋Š” ํŽ˜์ด์ง€๊ฐ€ ์—ด๋ฆฝ๋‹ˆ๋‹ค.

gcloud

  • ์˜ˆ์•ฝ ๋ชฉ๋ก์„ ๋ณด๋ ค๋ฉด gcloud compute reservations list ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

    gcloud compute reservations list
    

    ์ถœ๋ ฅ์€ ๋‹ค์Œ ์˜ˆ์‹œ์™€ ๋น„์Šทํ•ฉ๋‹ˆ๋‹ค.

    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
    

    ์„ ํƒ์ ์œผ๋กœ ํ•„ํ„ฐ ํ‘œํ˜„์‹์„ ์‚ฌ์šฉํ•˜์—ฌ ์˜ˆ์•ฝ ๋ชฉ๋ก์„ ๋ฏธ์„ธ ์กฐ์ •ํ•˜๋ ค๋ฉด --filter ํ”Œ๋ž˜๊ทธ๋ฅผ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค.

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

    FILTER_EXPRESSION์„ ํ•„ํ„ฐ ํ‘œํ˜„์‹์œผ๋กœ ๋ฐ”๊ฟ‰๋‹ˆ๋‹ค.

  • ์˜ˆ์•ฝ ์„ธ๋ถ€์ •๋ณด๋ฅผ ๋ณด๋ ค๋ฉด gcloud compute reservations describe ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

    gcloud compute reservations describe RESERVATION_NAME \
        --zone=ZONE
    

    ๋‹ค์Œ์„ ๋ฐ”๊ฟ‰๋‹ˆ๋‹ค.

    • RESERVATION_NAME: ๊ธฐ์กด ์˜ˆ์•ฝ์˜ ์ด๋ฆ„์ž…๋‹ˆ๋‹ค.

    • ZONE: ์˜ˆ์•ฝ์ด ์žˆ๋Š” ์˜์—ญ์ž…๋‹ˆ๋‹ค.

    ์ถœ๋ ฅ์€ ๋‹ค์Œ ์˜ˆ์‹œ์™€ ๋น„์Šทํ•ฉ๋‹ˆ๋‹ค.

    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

  • ์˜ˆ์•ฝ ๋ชฉ๋ก์„ ๋ณด๋ ค๋ฉด ๋‹ค์Œ ์ฝ”๋“œ ์ƒ˜ํ”Œ์„ ์‚ฌ์šฉํ•˜์„ธ์š”.

    // 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
    }
    
    
  • ์˜ˆ์•ฝ ์„ธ๋ถ€์ •๋ณด๋ฅผ ๋ณด๋ ค๋ฉด ๋‹ค์Œ ์ฝ”๋“œ ์ƒ˜ํ”Œ์„ ์‚ฌ์šฉํ•˜์„ธ์š”.

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

์ž๋ฐ”

  • ์˜ˆ์•ฝ ๋ชฉ๋ก์„ ๋ณด๋ ค๋ฉด ๋‹ค์Œ ์ฝ”๋“œ ์ƒ˜ํ”Œ์„ ์‚ฌ์šฉํ•˜์„ธ์š”.

    /*
     * 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;
      }
    }
  • ์˜ˆ์•ฝ ์„ธ๋ถ€์ •๋ณด๋ฅผ ๋ณด๋ ค๋ฉด ๋‹ค์Œ ์ฝ”๋“œ ์ƒ˜ํ”Œ์„ ์‚ฌ์šฉํ•˜์„ธ์š”.

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

  • ์˜ˆ์•ฝ ๋ชฉ๋ก์„ ๋ณด๋ ค๋ฉด ๋‹ค์Œ ์ฝ”๋“œ ์ƒ˜ํ”Œ์„ ์‚ฌ์šฉํ•˜์„ธ์š”.

    /*
     * 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;
    });
    
  • ์˜ˆ์•ฝ ์„ธ๋ถ€์ •๋ณด๋ฅผ ๋ณด๋ ค๋ฉด ๋‹ค์Œ ์ฝ”๋“œ ์ƒ˜ํ”Œ์„ ์‚ฌ์šฉํ•˜์„ธ์š”.

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

  • ์˜ˆ์•ฝ ๋ชฉ๋ก์„ ๋ณด๋ ค๋ฉด ๋‹ค์Œ ์ฝ”๋“œ ์ƒ˜ํ”Œ์„ ์‚ฌ์šฉํ•˜์„ธ์š”.

    # 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
    
    
    
  • ์˜ˆ์•ฝ ์„ธ๋ถ€์ •๋ณด๋ฅผ ๋ณด๋ ค๋ฉด ๋‹ค์Œ ์ฝ”๋“œ ์ƒ˜ํ”Œ์„ ์‚ฌ์šฉํ•˜์„ธ์š”.

    # 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

  • ์˜ˆ์•ฝ ๋ชฉ๋ก์„ ๋ณด๋ ค๋ฉด GET ์š”์ฒญ์„ reservations.list ๋ฉ”์„œ๋“œ๋กœ ์ „์†กํ•ฉ๋‹ˆ๋‹ค.

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

    ๋‹ค์Œ์„ ๋ฐ”๊ฟ‰๋‹ˆ๋‹ค.

    • PROJECT_ID: ์˜ˆ์•ฝ์„ ๋งŒ๋“  ํ”„๋กœ์ ํŠธ์˜ ID์ž…๋‹ˆ๋‹ค.

    • ZONE: ์˜ˆ์•ฝ์ด ์žˆ๋Š” ์˜์—ญ์ž…๋‹ˆ๋‹ค.

    ์ถœ๋ ฅ์€ ๋‹ค์Œ ์˜ˆ์‹œ์™€ ๋น„์Šทํ•ฉ๋‹ˆ๋‹ค.

    {
      "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"
      }
    }
    

    ์„ ํƒ์ ์œผ๋กœ ํ•„ํ„ฐ ํ‘œํ˜„์‹์„ ์‚ฌ์šฉํ•˜์—ฌ ์˜ˆ์•ฝ ๋ชฉ๋ก์„ ๋ฏธ์„ธ ์กฐ์ •ํ•˜๋ ค๋ฉด filter ์ฟผ๋ฆฌ ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค.

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

    FILTER_EXPRESSION์„ URL ์ธ์ฝ”๋”ฉ ๊ฐ’์„ ์‚ฌ์šฉํ•˜๋Š” ํ•„ํ„ฐ ํ‘œํ˜„์‹์œผ๋กœ ๋ฐ”๊ฟ‰๋‹ˆ๋‹ค.

  • ์˜ˆ์•ฝ ์„ธ๋ถ€์ •๋ณด๋ฅผ ๋ณด๋ ค๋ฉด GET ์š”์ฒญ์„ reservations.get ๋ฉ”์„œ๋“œ๋กœ ์ „์†กํ•ฉ๋‹ˆ๋‹ค.

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

    ๋‹ค์Œ์„ ๋ฐ”๊ฟ‰๋‹ˆ๋‹ค.

    • PROJECT_ID: ์˜ˆ์•ฝ์„ ๋งŒ๋“  ํ”„๋กœ์ ํŠธ์˜ ID์ž…๋‹ˆ๋‹ค.

    • ZONE: ์˜ˆ์•ฝ์ด ์žˆ๋Š” ์˜์—ญ์ž…๋‹ˆ๋‹ค.

    • RESERVATION_NAME: ๊ธฐ์กด ์˜ˆ์•ฝ์˜ ์ด๋ฆ„์ž…๋‹ˆ๋‹ค.

    ์ถœ๋ ฅ์€ ๋‹ค์Œ ์˜ˆ์‹œ์™€ ๋น„์Šทํ•ฉ๋‹ˆ๋‹ค.

    {
      "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"
      }
    }
    

๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ ๋ณด๊ธฐ

ํ•˜๋‚˜ ์ด์ƒ์˜ ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์˜ ์„ค์ •์„ ๋ณด๋ ค๋ฉด ์ด ์„น์…˜์— ์„ค๋ช…๋œ ๋‹ค์Œ ๋ฐฉ๋ฒ• ์ค‘ ํ•˜๋‚˜๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

  • ํ”„๋กœ์ ํŠธ์—์„œ ๋ชจ๋“  ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์˜ ๊ฐœ์š”๋ฅผ ๋ณด๋ ค๋ฉด ์š”์ฒญ ๋ชฉ๋ก์„ ๋ด…๋‹ˆ๋‹ค.

  • ๋‹จ์ผ ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์˜ ์ „์ฒด ์„ธ๋ถ€์ •๋ณด๋ฅผ ๋ณด๋ ค๋ฉด ํ•ด๋‹น ์š”์ฒญ์˜ ์„ธ๋ถ€์ •๋ณด๋ฅผ ๋ด…๋‹ˆ๋‹ค.

๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์„ ๋ณด๋ ค๋ฉด ๋‹ค์Œ ์˜ต์…˜ ์ค‘ ํ•˜๋‚˜๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

์ฝ˜์†”

  1. Google Cloud ์ฝ˜์†”์—์„œ ์˜ˆ์•ฝ ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.

    ์˜ˆ์•ฝ์œผ๋กœ ์ด๋™

  2. ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ํƒญ์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

    ํ‘œ์— ๊ฐ ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์ด ๋‚˜์—ด๋˜๊ณ  ๊ฐ ํ…Œ์ด๋ธ” ์—ด์— ์†์„ฑ ์„ค๋ช…์ด ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.

  3. ์„ ํƒ์‚ฌํ•ญ: ์š”์ฒญ ๋ชฉ๋ก์„ ๋ฏธ์„ธ ์กฐ์ •ํ•˜๋ ค๋ฉด ํ•„ํ„ฐ ํ•„๋“œ์—์„œ ์š”์ฒญ์„ ํ•„ํ„ฐ๋งํ•˜๋ ค๋Š” ์†์„ฑ์„ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

  4. ์š”์ฒญ์˜ ์„ธ๋ถ€์ •๋ณด๋ฅผ ๋ณด๋ ค๋ฉด ์ด๋ฆ„ ์—ด์—์„œ ์š”์ฒญ์˜ ์ด๋ฆ„์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค. ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์— ๋Œ€ํ•œ ์„ธ๋ถ€์ •๋ณด๊ฐ€ ํฌํ•จ๋œ ํŽ˜์ด์ง€๊ฐ€ ์—ด๋ฆฝ๋‹ˆ๋‹ค.

gcloud

  • ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ ๋ชฉ๋ก์„ ๋ณด๋ ค๋ฉด gcloud beta compute future-reservations list ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

    gcloud beta compute future-reservations list
    

    ์ถœ๋ ฅ์€ ๋‹ค์Œ ์˜ˆ์‹œ์™€ ๋น„์Šทํ•ฉ๋‹ˆ๋‹ค.

    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
    

    ์„ ํƒ์ ์œผ๋กœ ํ•„ํ„ฐ ํ‘œํ˜„์‹์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ ๋ชฉ๋ก์„ ๋ฏธ์„ธ ์กฐ์ •ํ•˜๋ ค๋ฉด --filter ํ”Œ๋ž˜๊ทธ๋ฅผ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค.

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

    FILTER_EXPRESSION์„ ํ•„ํ„ฐ ํ‘œํ˜„์‹์œผ๋กœ ๋ฐ”๊ฟ‰๋‹ˆ๋‹ค.

  • ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์˜ ์„ธ๋ถ€์ •๋ณด๋ฅผ ๋ณด๋ ค๋ฉด gcloud beta compute future-reservations describe ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

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

    ๋‹ค์Œ์„ ๋ฐ”๊ฟ‰๋‹ˆ๋‹ค.

    • FUTURE_RESERVATION_NAME: ๊ธฐ์กด ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์˜ ์ด๋ฆ„์ž…๋‹ˆ๋‹ค.

    • ZONE: ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์ด ์žˆ๋Š” ์˜์—ญ์ž…๋‹ˆ๋‹ค.

    ์ถœ๋ ฅ์€ ๋‹ค์Œ ์˜ˆ์‹œ์™€ ๋น„์Šทํ•ฉ๋‹ˆ๋‹ค.

    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

  • ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ ๋ชฉ๋ก์„ ๋ณด๋ ค๋ฉด ๋ฒ ํƒ€ futureReservations.list ๋ฉ”์„œ๋“œ์— ๋Œ€ํ•ด GET ์š”์ฒญ์„ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.

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

    ๋‹ค์Œ์„ ๋ฐ”๊ฟ‰๋‹ˆ๋‹ค.

    • PROJECT_ID: ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์„ ๋งŒ๋“  ํ”„๋กœ์ ํŠธ์˜ ID์ž…๋‹ˆ๋‹ค.

    • ZONE: ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์ด ์žˆ๋Š” ์˜์—ญ์ž…๋‹ˆ๋‹ค.

    ์ถœ๋ ฅ์€ ๋‹ค์Œ ์˜ˆ์‹œ์™€ ๋น„์Šทํ•ฉ๋‹ˆ๋‹ค.

    {
      "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"
    }
    

    ์„ ํƒ์ ์œผ๋กœ ํ•„ํ„ฐ ํ‘œํ˜„์‹์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ ๋ชฉ๋ก์„ ๋ฏธ์„ธ ์กฐ์ •ํ•˜๋ ค๋ฉด filter ์ฟผ๋ฆฌ ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค.

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

    FILTER_EXPRESSION์„ URL ์ธ์ฝ”๋”ฉ ๊ฐ’์„ ์‚ฌ์šฉํ•˜๋Š” ํ•„ํ„ฐ ํ‘œํ˜„์‹์œผ๋กœ ๋ฐ”๊ฟ‰๋‹ˆ๋‹ค.

  • ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์˜ ์„ธ๋ถ€์ •๋ณด๋ฅผ ๋ณด๋ ค๋ฉด ๋ฒ ํƒ€ futureReservations.get ๋ฉ”์„œ๋“œ์— GET ์š”์ฒญ์„ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.

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

    ๋‹ค์Œ์„ ๋ฐ”๊ฟ‰๋‹ˆ๋‹ค.

    • PROJECT_ID: ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์„ ๋งŒ๋“  ํ”„๋กœ์ ํŠธ์˜ ID์ž…๋‹ˆ๋‹ค.

    • ZONE: ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์ด ์žˆ๋Š” ์˜์—ญ์ž…๋‹ˆ๋‹ค.

    • FUTURE_RESERVATION_NAME: ๊ธฐ์กด ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์˜ ์ด๋ฆ„์ž…๋‹ˆ๋‹ค.

    ์ถœ๋ ฅ์€ ๋‹ค์Œ๊ณผ ๋น„์Šทํ•ฉ๋‹ˆ๋‹ค.

    {
      "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"
    }
    

์†Œ๋น„ ๊ฐ€๋Šฅํ•œ ์ธ์Šคํ„ด์Šค ์ˆ˜ ๊ฒฐ์ •

์˜ˆ์•ฝ๋œ ์šฉ๋Ÿ‰์„ ์†Œ๋น„ํ•  ์ˆ˜ ์žˆ๋Š” ์ปดํ“จํŒ… ์ธ์Šคํ„ด์Šค ์ˆ˜๋ฅผ ๊ฒฐ์ •ํ•˜๋ ค๋ฉด ๋‹ค์Œ ์ค‘ ํ•˜๋‚˜๋ฅผ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.

์˜ˆ์•ฝ์˜ ์†Œ๋น„ ๊ฐ€๋Šฅํ•œ ์ธ์Šคํ„ด์Šค

์˜ˆ์•ฝ์˜ ์„ธ๋ถ€์ •๋ณด๋ฅผ ๋ณผ ๋•Œ๋Š” ๋‹ค์Œ ํ•„๋“œ๋ฅผ ํ™•์ธํ•˜์—ฌ ์˜ˆ์•ฝ์„ ์†Œ๋น„ ์ค‘์ธ ์ปดํ“จํŒ… ์ธ์Šคํ„ด์Šค ์ˆ˜, ์˜ˆ์•ฝ์„ ์†Œ๋น„ํ•  ์ˆ˜ ์žˆ๋Š” ์ธ์Šคํ„ด์Šค ์ˆ˜๋ฅผ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • ๋ณด์žฅ๋œ ์ˆ˜(assuredCount): ์˜ˆ์•ฝ ์˜์—ญ ๋‚ด์— ๋ฌผ๋ฆฌ์ ์œผ๋กœ ์˜ˆ์•ฝ๋œ ์ธ์Šคํ„ด์Šค ์ˆ˜์ž…๋‹ˆ๋‹ค. ์ด ์ˆซ์ž์—๋Š” ์‚ฌ์šฉ์ž์˜ ํ”„๋กœ์ ํŠธ ๊ทธ๋ฆฌ๊ณ  ๊ณต์œ  ์˜ˆ์•ฝ์ด ๊ณต์œ ๋œ ๋ชจ๋“  ํ”„๋กœ์ ํŠธ์— ๋Œ€ํ•ด ์˜ˆ์•ฝ๋œ ์ธ์Šคํ„ด์Šค๊ฐ€ ํฌํ•จ๋ฉ๋‹ˆ๋‹ค.

  • ์ด ๊ฐœ์ˆ˜(count): ์˜ˆ์•ฝ์— ์ง€์ •๋œ ์˜ˆ์•ฝ๋œ ์ธ์Šคํ„ด์Šค ์ˆ˜์ž…๋‹ˆ๋‹ค. ์ด ์ˆซ์ž๋Š” ๋ณด์žฅ๋œ ์ˆ˜์™€ ์ผ์น˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

  • ์‚ฌ์šฉ ์ค‘์ธ ๋จธ์‹ (inUseCount): ์‚ฌ์šฉ์ž์˜ ํ”„๋กœ์ ํŠธ ๋˜๋Š” ๊ณต์œ  ์˜ˆ์•ฝ์ด ๊ณต์œ ๋œ ํ”„๋กœ์ ํŠธ์—์„œ ์˜ˆ์•ฝ์„ ์†Œ๋น„ ์ค‘์ด๊ณ  ์‹คํ–‰ ์ค‘์ธ ์ธ์Šคํ„ด์Šค ์ˆ˜์ž…๋‹ˆ๋‹ค.

์˜ˆ๋ฅผ ๋“ค์–ด ๋ณด์žฅ๋œ ์ˆ˜(assuredCount)์™€ ์ด ๊ฐœ์ˆ˜(count)๊ฐ€ ๋ชจ๋‘ 50์ด๊ณ , ์˜ˆ์•ฝ์„ ์†Œ๋น„ ์ค‘์ธ ์ธ์Šคํ„ด์Šค ์ˆ˜(inUseCount)๊ฐ€ 25๋ฉด, ๋‚˜๋จธ์ง€ 25๊ฐœ์˜ ์ธ์Šคํ„ด์Šค๊ฐ€ ์˜ˆ์•ฝ์„ ๋” ์†Œ๋น„ํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ๊ทธ๋Ÿฐ ๋‹ค์Œ์— ์˜ˆ์•ฝ์ด ์™„์ „ํžˆ ์†Œ๋น„๋ฉ๋‹ˆ๋‹ค.

๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์˜ ์†Œ๋น„ ๊ฐ€๋Šฅํ•œ ์ธ์Šคํ„ด์Šค

๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์„ ์‹œ์ž‘ํ•  ๋•Œ Compute Engine์ด ์˜ˆ์•ฝ์„ ๋งŒ๋“œ๋Š” ์ปดํ“จํŒ… ์ธ์Šคํ„ด์Šค ์ˆ˜๋ฅผ ๊ฒฐ์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ดˆ์•ˆ, ๋Œ€๊ธฐ ์ค‘์ธ ์Šน์ธ, ์Šน์ธ๋œ ์š”์ฒญ์˜ ๊ฒฝ์šฐ ์ด ์ˆซ์ž๋ฅผ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ฒฐ์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  1. ์‚ฌ์šฉ์ž์˜ ํ”„๋กœ์ ํŠธ ๊ทธ๋ฆฌ๊ณ  ์š”์ฒญ์ด ๊ณต์œ ๋˜์—ˆ๊ณ  ์š”์ฒญ ์†์„ฑ๊ณผ ์ผ์น˜ํ•˜๋Š” ํ”„๋กœ์ ํŠธ์—์„œ ์‹คํ–‰ ์ค‘์ธ ์ธ์Šคํ„ด์Šค์™€ ์‚ฌ์šฉ๋˜์ง€ ์•Š์€ ์˜ˆ์•ฝ ์ˆ˜๋ฅผ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

  2. ์š”์ฒญ์˜ ์ด ๊ฐœ์ˆ˜์—์„œ ์ผ์น˜ํ•˜๋Š” ์‹คํ–‰ ์ค‘์ธ ์ธ์Šคํ„ด์Šค ๋ฐ ์‚ฌ์šฉ๋˜์ง€ ์•Š์€ ์˜ˆ์•ฝ ์ˆ˜๋ฅผ ๋บ๋‹ˆ๋‹ค.

๋‹จ์ผ ๋˜๋Š” ์—ฌ๋Ÿฌ ์š”์ฒญ์— ๋Œ€ํ•ด ํ•œ ๋ฒˆ์— ์†Œ๋น„ ๊ฐ€๋Šฅํ•œ ์ธ์Šคํ„ด์Šค ์ˆ˜๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์—ฌ๋Ÿฌ ์š”์ฒญ์˜ ๊ฒฝ์šฐ Google Cloud ์ฝ˜์†” ๋˜๋Š” REST API๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ๋‹จ์ผ ์š”์ฒญ์˜ ๊ฒฝ์šฐ ๋‹ค์Œ ์˜ต์…˜์„ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

์ฝ˜์†”

  1. Google Cloud ์ฝ˜์†”์—์„œ ์˜ˆ์•ฝ ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.

    ์˜ˆ์•ฝ์œผ๋กœ ์ด๋™

  2. ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ํƒญ์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

    ํ‘œ์— ๊ฐ ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์ด ๋‚˜์—ด๋˜๊ณ  ๊ฐ ํ…Œ์ด๋ธ” ์—ด์— ์†์„ฑ ์„ค๋ช…์ด ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.

  3. Compute Engine์ด ์‹œ์ž‘ ์‹œ ์š”์ฒญ์— ๋Œ€ํ•ด ์˜ˆ์•ฝํ•˜๋ ค๋Š” ์ธ์Šคํ„ด์Šค ์ˆ˜๋ฅผ ๊ฒฐ์ •ํ•˜๋ ค๋ฉด ์ด ๊ฐœ์ˆ˜ ์—ด์—์„œ ์ผ์น˜ ๊ฐœ์ˆ˜ ์—ด์„ ๋บ๋‹ˆ๋‹ค.

    ์ผ์น˜ ๊ฐœ์ˆ˜ ์—ด์— ๋‹ค์Œ ๊ฒฝ๊ณ  ์ค‘ ํ•˜๋‚˜๊ฐ€ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.

    • ์ผ์น˜ ๊ฐœ์ˆ˜๊ฐ€ 0์ž„: ์‚ฌ์šฉ์ž์˜ ํ”„๋กœ์ ํŠธ ๋˜๋Š” ์š”์ฒญ์ด ๊ณต์œ ๋œ ํ”„๋กœ์ ํŠธ์—์„œ ์ผ์น˜ํ•˜๋Š” ์‹คํ–‰ ์ค‘์ธ ์ธ์Šคํ„ด์Šค ๋˜๋Š” ์‚ฌ์šฉ๋˜์ง€ ์•Š์€ ์˜ˆ์•ฝ์ด ์—†์Šต๋‹ˆ๋‹ค.

    • ์ผ์น˜ ๊ฐœ์ˆ˜๊ฐ€ ์ด ๊ฐœ์ˆ˜์™€ ๊ฐ™์Œ: Compute Engine์ด ์‹œ์ž‘ ์‹œ ์š”์ฒญ์— ๋Œ€ํ•ด ์ธ์Šคํ„ด์Šค๋ฅผ ์˜ˆ์•ฝํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

    ์š”์ฒญ์„ ์ˆ˜์ •ํ•˜๊ฑฐ๋‚˜ ์š”์ฒญ๊ณผ ์ผ์น˜ํ•˜๋Š” ์ƒˆ ์ธ์Šคํ„ด์Šค ๋˜๋Š” ์˜ˆ์•ฝ์„ ๋งŒ๋“ค๋ฉด Compute Engine์ด 30๋ถ„ ๋‚ด์— ์ผ์น˜ ๊ฐœ์ˆ˜ ์—ด์„ ์—…๋ฐ์ดํŠธํ•ฉ๋‹ˆ๋‹ค.

  4. ์„ ํƒ์‚ฌํ•ญ: ์š”์ฒญ์—์„œ ์ผ์น˜ ๊ฐœ์ˆ˜ ์—ด์ด ๋งˆ์ง€๋ง‰์œผ๋กœ ์—…๋ฐ์ดํŠธ๋œ ์‹œ๊ฐ„์„ ํ™•์ธํ•˜๋ ค๋ฉด ๋‹ค์Œ์„ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.

    1. ์ด๋ฆ„ ์—ด์—์„œ ์š”์ฒญ์˜ ์ด๋ฆ„์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค. ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์— ๋Œ€ํ•œ ์„ธ๋ถ€์ •๋ณด๊ฐ€ ํฌํ•จ๋œ ํŽ˜์ด์ง€๊ฐ€ ์—ด๋ฆฝ๋‹ˆ๋‹ค.

    2. ๋ฆฌ์†Œ์Šค ์„ธ๋ถ€์ •๋ณด ์„น์…˜์—์„œ ๋งˆ์ง€๋ง‰ ์ผ์น˜ ์‚ฌ์šฉ๋Ÿ‰ ํ‰๊ฐ€ ์‹œ๊ฐ„ ํ•„๋“œ๋ฅผ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

gcloud

  1. ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์˜ ์„ธ๋ถ€์ •๋ณด๋ฅผ ๋ณด๋ ค๋ฉด gcloud beta compute future-reservations describe ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

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

    ๋‹ค์Œ์„ ๋ฐ”๊ฟ‰๋‹ˆ๋‹ค.

    • FUTURE_RESERVATION_NAME: ๊ธฐ์กด ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์˜ ์ด๋ฆ„์ž…๋‹ˆ๋‹ค.

    • ZONE: ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์ด ์žˆ๋Š” ์˜์—ญ์ž…๋‹ˆ๋‹ค.

    ์ถœ๋ ฅ์—์„œ count ๋ฐ totalCount ํ•„๋“œ๋ฅผ ์ฐพ์Šต๋‹ˆ๋‹ค.

    ...
    specificSkuProperties:
      ...
      totalCount: '100'
    status:
      existingMatchingUsageInfo:
        count: '50'
        timestamp: '2025-03-30T01:00:00Z'
      ...
      procurementStatus: DRAFTING
    ...
    
  2. totalCount์—์„œ count์˜ ๊ฐ’์„ ๋บ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด count๊ฐ€ 50์ด๊ณ  totalCount๊ฐ€ 100์ด๋ฉด Compute Engine์ด ์š”์ฒญ ์‹œ์ž‘ ์‹œ์— 50๊ฐœ ์ธ์Šคํ„ด์Šค์— ๋Œ€ํ•ด ์ž๋™์œผ๋กœ ์˜ˆ์•ฝ์„ ๋งŒ๋“ญ๋‹ˆ๋‹ค.

    ์š”์ฒญ์„ ์ˆ˜์ •ํ•˜๊ฑฐ๋‚˜ ์š”์ฒญ๊ณผ ์ผ์น˜ํ•˜๋Š” ์ƒˆ ์ธ์Šคํ„ด์Šค ๋˜๋Š” ์˜ˆ์•ฝ์„ ๋งŒ๋“ค๋ฉด Compute Engine์ด 30๋ถ„ ๋‚ด์— existingMatchingUsageInfo ํ•„๋“œ๋ฅผ ์—…๋ฐ์ดํŠธํ•ฉ๋‹ˆ๋‹ค. ์ด ํ•„๋“œ๊ฐ€ ๋งˆ์ง€๋ง‰์œผ๋กœ ์—…๋ฐ์ดํŠธ๋œ ์‹œ์ ์„ ํ™•์ธํ•˜๋ ค๋ฉด existingMatchingUsageInfo.timestamp์˜ ๊ฐ’์„ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

REST

  1. ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ ๋ชฉ๋ก์„ ๋ณด๋ ค๋ฉด ๋ฒ ํƒ€ futureReservations.list ๋ฉ”์„œ๋“œ์— ๋Œ€ํ•ด GET ์š”์ฒญ์„ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค. ์š”์ฒญ URL์—์„œ filter ์ฟผ๋ฆฌ ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ํฌํ•จํ•˜๊ณ  name, specificSkuProperties, status ํ•„๋“œ๋งŒ ํ‘œ์‹œํ•˜๋„๋ก ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค.

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

    ๋‹ค์Œ์„ ๋ฐ”๊ฟ‰๋‹ˆ๋‹ค.

    • PROJECT_ID: ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์„ ๋งŒ๋“  ํ”„๋กœ์ ํŠธ์˜ ID์ž…๋‹ˆ๋‹ค.

    • ZONE: ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์ด ์žˆ๋Š” ์˜์—ญ์ž…๋‹ˆ๋‹ค.

    ์ถœ๋ ฅ์—์„œ ๊ฐ ์ดˆ์•ˆ, ๋Œ€๊ธฐ ์ค‘์ธ ์Šน์ธ, ์Šน์ธ๋œ ์š”์ฒญ์— ๋Œ€ํ•ด count ๋ฐ totalCount ํ•„๋“œ๋ฅผ ์ฐพ์Šต๋‹ˆ๋‹ค.

    {
      "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. ๊ฐ ์š”์ฒญ์— ๋Œ€ํ•ด totalCount์—์„œ count์˜ ๊ฐ’์„ ๋บ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด count๊ฐ€ 50์ด๊ณ  totalCount๊ฐ€ 100์ด๋ฉด Compute Engine์ด ์š”์ฒญ ์‹œ์ž‘ ์‹œ์— 50๊ฐœ ์ธ์Šคํ„ด์Šค์— ๋Œ€ํ•ด ์ž๋™์œผ๋กœ ์˜ˆ์•ฝ์„ ๋งŒ๋“ญ๋‹ˆ๋‹ค.

    ์š”์ฒญ์„ ์ˆ˜์ •ํ•˜๊ฑฐ๋‚˜ ์š”์ฒญ๊ณผ ์ผ์น˜ํ•˜๋Š” ์ƒˆ ์ธ์Šคํ„ด์Šค ๋˜๋Š” ์˜ˆ์•ฝ์„ ๋งŒ๋“ค๋ฉด Compute Engine์ด 30๋ถ„ ๋‚ด์— existingMatchingUsageInfo ํ•„๋“œ๋ฅผ ์—…๋ฐ์ดํŠธํ•ฉ๋‹ˆ๋‹ค. ์ด ํ•„๋“œ๊ฐ€ ๋งˆ์ง€๋ง‰์œผ๋กœ ์—…๋ฐ์ดํŠธ๋œ ์‹œ์ ์„ ํ™•์ธํ•˜๋ ค๋ฉด existingMatchingUsageInfo.timestamp์˜ ๊ฐ’์„ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

์บ˜๋ฆฐ๋” ๋ชจ๋“œ์˜ ๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์˜ ์†Œ๋น„ ๊ฐ€๋Šฅํ•œ ์ธ์Šคํ„ด์Šค

๋ฏธ๋ž˜์šฉ ์˜ˆ์•ฝ ์š”์ฒญ์˜ ์„ธ๋ถ€์ •๋ณด๋ฅผ ๋ณผ ๋•Œ Compute Engine์ด ์š”์ฒญ ์‹œ์ž‘ ์‹œ๊ฐ„์— ํ”„๋กœ๋น„์ €๋‹ํ•  ์ปดํ“จํŒ… ์ธ์Šคํ„ด์Šค ์ˆ˜๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Compute Engine์€ ํ”„๋กœ์ ํŠธ ๋˜๋Š” ์š”์ฒญ์ด ๊ณต์œ ๋œ ํ”„๋กœ์ ํŠธ์—์„œ ์ผ์น˜ํ•˜๋Š” ์ธ์Šคํ„ด์Šค ์ˆ˜์™€ ๊ด€๊ณ„์—†์ด ์š”์ฒญ์— ์ง€์ •๋œ ์ธ์Šคํ„ด์Šค ์ˆ˜๋ฅผ ๋งŒ๋“ญ๋‹ˆ๋‹ค.

๋‹ค์Œ ๋‹จ๊ณ„