Compute Engine ์ธ์Šคํ„ด์Šค ์ค‘์ง€ ๋˜๋Š” ๋‹ค์‹œ ์‹œ์ž‘


์ด ๋ฌธ์„œ์—์„œ๋Š” Compute Engine ์ธ์Šคํ„ด์Šค๋ฅผ ์ค‘์ง€ํ•˜๊ฑฐ๋‚˜ ๋‹ค์‹œ ์‹œ์ž‘ํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์„ค๋ช…ํ•ฉ๋‹ˆ๋‹ค. ์ธ์Šคํ„ด์Šค ์ผ์‹œ์ค‘์ง€, ์ค‘์ง€ ๋˜๋Š” ์žฌ์„ค์ •์— ๊ด€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ 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.

        ์ž์„ธํ•œ ๋‚ด์šฉ์€ ๋‹ค์Œ์„ ์ฐธ์กฐํ•˜์„ธ์š”: 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.

        ์ž์„ธํ•œ ๋‚ด์šฉ์€ ๋‹ค์Œ์„ ์ฐธ์กฐํ•˜์„ธ์š”: 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.

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

        PHP

        ๋กœ์ปฌ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์—์„œ ์ด ํŽ˜์ด์ง€์˜ PHP ์ƒ˜ํ”Œ์„ ์‚ฌ์šฉํ•˜๋ ค๋ฉด 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.

        ์ž์„ธํ•œ ๋‚ด์šฉ์€ ๋‹ค์Œ์„ ์ฐธ์กฐํ•˜์„ธ์š”: 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.

        ์ž์„ธํ•œ ๋‚ด์šฉ์€ ๋‹ค์Œ์„ ์ฐธ์กฐํ•˜์„ธ์š”: 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 ์‚ฌ์šฉ์„ ์œ„ํ•œ ์ธ์ฆ์„ ์ฐธ์กฐํ•˜์„ธ์š”.

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

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

์ด ์‚ฌ์ „ ์ •์˜๋œ ์—ญํ• ์—๋Š” ์ปดํ“จํŒ… ์ธ์Šคํ„ด์Šค๋ฅผ ์ค‘์ง€ํ•˜๊ฑฐ๋‚˜ ๋‹ค์‹œ ์‹œ์ž‘ํ•˜๋Š” ๋ฐ ํ•„์š”ํ•œ ๊ถŒํ•œ์ด ํฌํ•จ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ํ•„์š”ํ•œ ์ •ํ™•ํ•œ ๊ถŒํ•œ์„ ๋ณด๋ ค๋ฉด ํ•„์ˆ˜ ๊ถŒํ•œ ์„น์…˜์„ ํŽผ์น˜์„ธ์š”.

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

์ปดํ“จํŒ… ์ธ์Šคํ„ด์Šค๋ฅผ ์ค‘์ง€ํ•˜๊ฑฐ๋‚˜ ๋‹ค์‹œ ์‹œ์ž‘ํ•˜๋ ค๋ฉด ๋‹ค์Œ ๊ถŒํ•œ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

  • ์ธ์Šคํ„ด์Šค๋ฅผ ์ค‘์ง€ํ•˜๋ ค๋ฉด: ์ธ์Šคํ„ด์Šค์— ๋Œ€ํ•œ compute.instances.stop
  • ๊ฒŒ์ŠคํŠธ OS์—์„œ ์ธ์Šคํ„ด์Šค๋ฅผ ์ค‘์ง€ํ•˜๋ ค๋ฉด: ์ธ์Šคํ„ด์Šค ์ˆ˜์ค€ ๊ณต๊ฐœ SSH ํ‚ค๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ ์ธ์Šคํ„ด์Šค์— ๋Œ€ํ•œ compute.instances.setMetadata
  • ์ธ์Šคํ„ด์Šค๋ฅผ ๋‹ค์‹œ ์‹œ์ž‘ํ•˜๋ ค๋ฉด: ์ธ์Šคํ„ด์Šค์— ๋Œ€ํ•œ compute.instances.start
  • ์•”ํ˜ธํ™” ํ‚ค๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ์ธ์Šคํ„ด์Šค๋ฅผ ๋‹ค์‹œ ์‹œ์ž‘ํ•˜๋ ค๋ฉด: ์ธ์Šคํ„ด์Šค์— ๋Œ€ํ•œ compute.instances.startWithEncryptionKey

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

์ธ์Šคํ„ด์Šค ์ค‘์ง€

์ปดํ“จํŒ… ์ธ์Šคํ„ด์Šค๋ฅผ ์ค‘์ง€ํ•˜๊ฑฐ๋‚˜ Compute Engine์—์„œ ์˜ˆ์•ฝ๋œ ์ž‘์—…์— ๋Œ€ํ•ด ์ค‘์ง€ํ•˜๋Š” ๊ฒฝ์šฐ ์ธ์Šคํ„ด์Šค๋Š” ํ•ด๋‹น ์ธ์Šคํ„ด์Šค์˜ ์—ฐ๊ฒฐ๋œ ๋ฆฌ์†Œ์Šค, ๊ตฌ์„ฑ ์„ค์ •, ๋‚ด๋ถ€ IP ์ฃผ์†Œ, MAC ์ฃผ์†Œ, ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ๋ฅผ ์œ ์ง€ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์ธ์Šคํ„ด์Šค๋Š” ์ธ๋ฉ”๋ชจ๋ฆฌ ๋ฐ์ดํ„ฐ์™€ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์ƒํƒœ๋ฅผ ์žƒ๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ์ƒํƒœ๋ฅผ ์œ ์ง€ํ•ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ ๋Œ€์‹  ์ธ์Šคํ„ด์Šค๋ฅผ ์ผ์‹œ์ค‘์ง€ํ•ฉ๋‹ˆ๋‹ค.

์ธ์Šคํ„ด์Šค์— ๋กœ์ปฌ SSD ๋””์Šคํฌ๊ฐ€ ์—ฐ๊ฒฐ๋˜์–ด ์žˆ๋Š”์ง€ ์—ฌ๋ถ€์™€ ์ข…๋ฃŒ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์ฒ˜๋ฆฌํ•  ๋ฐฉ๋ฒ•์— ๋”ฐ๋ผ ๋‹ค์Œ ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉํ•˜์—ฌ ์ธ์Šคํ„ด์Šค๋ฅผ ์ค‘์ง€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • ๋กœ์ปฌ SSD ๋””์Šคํฌ๊ฐ€ ์—†๋Š” ์ธ์Šคํ„ด์Šค ์ค‘์ง€

    ๋กœ์ปฌ SSD ๋””์Šคํฌ๊ฐ€ ์—ฐ๊ฒฐ๋˜์–ด ์žˆ์ง€ ์•Š์€ ํ•˜๋‚˜ ์ด์ƒ์˜ ์ธ์Šคํ„ด์Šค๋ฅผ ๋™์‹œ์— ์ค‘์ง€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ธ์Šคํ„ด์Šค์˜ ๋ชจ๋“  ์ข…๋ฃŒ ์Šคํฌ๋ฆฝํŠธ๋Š” ๊ธฐ๋ณธ ์ข…๋ฃŒ ๊ธฐ๊ฐ„ ๋‚ด์— ์‹คํ–‰์„ ์™„๋ฃŒํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

  • ๋กœ์ปฌ SSD ๋””์Šคํฌ๊ฐ€ ์žˆ๋Š” ์ธ์Šคํ„ด์Šค ์ค‘์ง€

    ๋กœ์ปฌ SSD ๋””์Šคํฌ๊ฐ€ ์—ฐ๊ฒฐ๋œ ํ•˜๋‚˜ ์ด์ƒ์˜ ์ธ์Šคํ„ด์Šค๋ฅผ ๋™์‹œ์— ์ค‘์ง€ํ•  ๋•Œ ํ•ด๋‹น ๋””์Šคํฌ์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์‚ญ์ œํ•˜๊ฑฐ๋‚˜ ๋ณด์กด(ํ”„๋ฆฌ๋ทฐ)ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ธ์Šคํ„ด์Šค์˜ ๋ชจ๋“  ์ข…๋ฃŒ ์Šคํฌ๋ฆฝํŠธ๋Š” ๊ธฐ๋ณธ ์ข…๋ฃŒ ๊ธฐ๊ฐ„ ๋‚ด์— ์‹คํ–‰์„ ์™„๋ฃŒํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

  • ๊ฒŒ์ŠคํŠธ OS์—์„œ ์ธ์Šคํ„ด์Šค ์ค‘์ง€

    ์ด ์ ‘๊ทผ ๋ฐฉ์‹์„ ์‚ฌ์šฉํ•˜๋ฉด ์ข…๋ฃŒ ์Šคํฌ๋ฆฝํŠธ ์‹คํ–‰์ด ์™„๋ฃŒ๋œ ํ›„์—๋งŒ ๋‹จ์ผ ์ธ์Šคํ„ด์Šค๋ฅผ ์ค‘์ง€ํ•˜๊ฑฐ๋‚˜, ๋‹จ๊ณ„์  ์ข…๋ฃŒ๊ฐ€ ์‚ฌ์šฉ ์„ค์ •๋œ ๊ฒฝ์šฐ ๋‹จ๊ณ„์ ์œผ๋กœ ์ข…๋ฃŒํ•˜์ง€ ์•Š๊ณ  ์ธ์Šคํ„ด์Šค๋ฅผ ์ค‘์ง€ํ•˜๊ฑฐ๋‚˜ ์ง„ํ–‰ ์ค‘์ธ ๋‹จ๊ณ„์  ์ข…๋ฃŒ๋ฅผ ์ข…๋ฃŒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์—ฐ๊ฒฐ๋œ ๋กœ์ปฌ SSD ๋””์Šคํฌ์˜ ๋ฐ์ดํ„ฐ๋ฅผ ๋‚ด๊ตฌ์„ฑ ์žˆ๋Š” ์Šคํ† ๋ฆฌ์ง€ ๋ณผ๋ฅจ์— ์ˆ˜๋™์œผ๋กœ ๋ฐฑ์—…ํ•˜์ง€ ์•Š์œผ๋ฉด ๊ฒŒ์ŠคํŠธ OS ๋‚ด์—์„œ ์ธ์Šคํ„ด์Šค๋ฅผ ์ค‘์ง€ํ•˜๋ฉด ํ•ด๋‹น ๋””์Šคํฌ์— ์žˆ๋Š” ๋ฐ์ดํ„ฐ๊ฐ€ ์‚ญ์ œ๋ฉ๋‹ˆ๋‹ค.

๋กœ์ปฌ SSD ๋””์Šคํฌ๊ฐ€ ์—†๋Š” ์ธ์Šคํ„ด์Šค ์ค‘์ง€

์ธ์Šคํ„ด์Šค๋ฅผ ์ค‘์ง€ํ•  ๋•Œ ์ˆ˜ํ–‰ํ•˜๋ ค๋Š” ์ž‘์—…์— ๋”ฐ๋ผ ๋‹ค์Œ ์˜ต์…˜์„ ์‚ฌ์šฉํ•˜์„ธ์š”.

  • ์ธ์Šคํ„ด์Šค์—์„œ ๋‹จ๊ณ„์  ์ข…๋ฃŒ๋ฅผ ์‚ฌ์šฉ ์„ค์ •ํ•œ ๊ฒฝ์šฐ Google Cloud ์ฝ˜์†”, gcloud CLI ๋˜๋Š” REST API๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋‹จ๊ณ„์  ์ข…๋ฃŒ ์—†์ด ์ธ์Šคํ„ด์Šค๋ฅผ ์ค‘๋‹จํ•˜๊ฑฐ๋‚˜ ์ง„ํ–‰ ์ค‘์ธ ๋‹จ๊ณ„์  ์ข…๋ฃŒ๋ฅผ ํ•ด์ œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • ์—ฌ๋Ÿฌ ์ธ์Šคํ„ด์Šค๋ฅผ ๋™์‹œ์— ์ค‘์ง€ํ•˜๋ ค๋ฉด Google Cloud ์ฝ˜์†”์„ ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜ ๋™์ผํ•œ ์˜์—ญ์— ์žˆ๋Š” ์ธ์Šคํ„ด์Šค์˜ ๊ฒฝ์šฐ gcloud CLI๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

ํ•˜๋‚˜ ์ด์ƒ์˜ ์ธ์Šคํ„ด์Šค๋ฅผ ์ค‘์ง€ํ•˜๋ ค๋ฉด ๋‹ค์Œ ์˜ต์…˜ ์ค‘ ํ•˜๋‚˜๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

์ฝ˜์†”

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

    VM ์ธ์Šคํ„ด์Šค๋กœ ์ด๋™

  2. ์ค‘์ง€ํ•  ์‹คํ–‰ ์ค‘์ธ ์ธ์Šคํ„ด์Šค๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

  3. ์ค‘์ง€๋ฅผ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค. ์ค‘์ง€ ์˜ต์…˜์ด ์—†์œผ๋ฉด ์ž‘์—… ๋”๋ณด๊ธฐ > ์ค‘์ง€๋ฅผ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

  4. ๋Œ€ํ™”์ƒ์ž์—์„œ ๋‹ค์Œ์„ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.

    1. ์„ ํƒ์‚ฌํ•ญ: ์ธ์Šคํ„ด์Šค๋ฅผ ๋‹จ๊ณ„์ ์œผ๋กœ ์ข…๋ฃŒํ•˜์ง€ ์•Š๊ณ  ์ค‘์ง€ํ•˜๊ฑฐ๋‚˜ ์ง„ํ–‰ ์ค‘์ธ ๋‹จ๊ณ„์  ์ข…๋ฃŒ๋ฅผ ์ข…๋ฃŒํ•˜๋ ค๋ฉด ๋‹จ๊ณ„์  ์ข…๋ฃŒ ๊ฑด๋„ˆ๋›ฐ๊ธฐ(ํ•ด๋‹นํ•˜๋Š” ๊ฒฝ์šฐ) ์ฒดํฌ๋ฐ•์Šค๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

    2. ์ค‘์ง€๋ฅผ ํด๋ฆญํ•˜์—ฌ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

gcloud

๋™์ผํ•œ ์˜์—ญ์—์„œ ํ•˜๋‚˜ ์ด์ƒ์˜ ์ธ์Šคํ„ด์Šค๋ฅผ ์ค‘์ง€ํ•˜๋ ค๋ฉด gcloud compute instances stop ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

gcloud compute instances stop INSTANCE_NAMES \
    --zone=ZONE

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

  • INSTANCE_NAMES: ๊ณต๋ฐฑ์œผ๋กœ ๊ตฌ๋ถ„๋œ ์ธ์Šคํ„ด์Šค ์ด๋ฆ„ ๋ชฉ๋ก(์˜ˆ: instance-01 instance-02 instance-03)

  • ZONE: ์ธ์Šคํ„ด์Šค๊ฐ€ ์žˆ๋Š” ์˜์—ญ

์„ ํƒ์ ์œผ๋กœ ํ•˜๋‚˜ ์ด์ƒ์˜ ์ธ์Šคํ„ด์Šค์—์„œ ๋‹จ๊ณ„์  ์ข…๋ฃŒ๋ฅผ ์‚ฌ์šฉ ์„ค์ •ํ•œ ๊ฒฝ์šฐ ์ธ์Šคํ„ด์Šค๋ฅผ ๋‹จ๊ณ„์ ์œผ๋กœ ์ข…๋ฃŒํ•˜์ง€ ์•Š๊ณ  ์ค‘์ง€ํ•˜๊ฑฐ๋‚˜ ์ง„ํ–‰ ์ค‘์ธ ๋‹จ๊ณ„์  ์ข…๋ฃŒ๋ฅผ ์ˆ˜๋™์œผ๋กœ ์ข…๋ฃŒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ ค๋ฉด --no-graceful-shutdown ํ”Œ๋ž˜๊ทธ์™€ ํ•จ๊ป˜ gcloud beta compute instances stop ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

gcloud beta compute instances stop INSTANCE_NAMES \
    --no-graceful-shutdown \
    --zone=ZONE

Go

import (
	"context"
	"fmt"
	"io"

	compute "cloud.google.com/go/compute/apiv1"
	computepb "cloud.google.com/go/compute/apiv1/computepb"
)

// stopInstance stops a started Google Compute Engine instance
func stopInstance(w io.Writer, projectID, zone, instanceName string) error {
	// projectID := "your_project_id"
	// zone := "europe-central2-b"
	// instanceName := "your_instance_name"

	ctx := context.Background()
	instancesClient, err := compute.NewInstancesRESTClient(ctx)
	if err != nil {
		return fmt.Errorf("NewInstancesRESTClient: %w", err)
	}
	defer instancesClient.Close()

	req := &computepb.StopInstanceRequest{
		Project:  projectID,
		Zone:     zone,
		Instance: instanceName,
	}

	op, err := instancesClient.Stop(ctx, req)
	if err != nil {
		return fmt.Errorf("unable to stop instance: %w", err)
	}

	if err = op.Wait(ctx); err != nil {
		return fmt.Errorf("unable to wait for the operation: %w", err)
	}

	fmt.Fprintf(w, "Instance stopped\n")

	return nil
}

์ž๋ฐ”


import com.google.api.gax.longrunning.OperationFuture;
import com.google.cloud.compute.v1.InstancesClient;
import com.google.cloud.compute.v1.Operation;
import com.google.cloud.compute.v1.Operation.Status;
import com.google.cloud.compute.v1.StopInstanceRequest;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

public class StopInstance {

  public static void main(String[] args)
      throws IOException, ExecutionException, InterruptedException, TimeoutException {
    // TODO(developer): Replace these variables before running the sample.
    /* project: project ID or project number of the Cloud project your instance belongs to.
       zone: name of the zone your instance belongs to.
       instanceName: name of the instance your want to stop.
     */
    String project = "your-project-id";
    String zone = "zone-name";
    String instanceName = "instance-name";

    stopInstance(project, zone, instanceName);
  }

  // Stops a started Google Compute Engine instance.
  public static void stopInstance(String project, String zone, String instanceName)
      throws IOException, ExecutionException, InterruptedException, TimeoutException {
    /* Initialize client that will be used to send requests. This client only needs to be created
       once, and can be reused for multiple requests. After completing all of your requests, call
       the `instancesClient.close()` method on the client to safely
       clean up any remaining background resources. */
    try (InstancesClient instancesClient = InstancesClient.create()) {

      StopInstanceRequest stopInstanceRequest = StopInstanceRequest.newBuilder()
          .setProject(project)
          .setZone(zone)
          .setInstance(instanceName)
          .build();

      OperationFuture<Operation, Operation> operation = instancesClient.stopAsync(
          stopInstanceRequest);
      Operation response = operation.get(3, TimeUnit.MINUTES);

      if (response.getStatus() == Status.DONE) {
        System.out.println("Instance stopped successfully ! ");
      }
    }
  }
}

Node.js

/**
 * TODO(developer): Uncomment and replace these variables before running the sample.
 */
// const projectId = 'YOUR_PROJECT_ID';
// const zone = 'europe-central2-b'
// const instanceName = 'YOUR_INSTANCE_NAME'

const compute = require('@google-cloud/compute');

async function stopInstance() {
  const instancesClient = new compute.InstancesClient();

  const [response] = await instancesClient.stop({
    project: projectId,
    zone,
    instance: instanceName,
  });
  let operation = response.latestResponse;
  const operationsClient = new compute.ZoneOperationsClient();

  // Wait for the operation to complete.
  while (operation.status !== 'DONE') {
    [operation] = await operationsClient.wait({
      operation: operation.name,
      project: projectId,
      zone: operation.zone.split('/').pop(),
    });
  }

  console.log('Instance stopped.');
}

stopInstance();

PHP

use Google\Cloud\Compute\V1\Client\InstancesClient;
use Google\Cloud\Compute\V1\StopInstanceRequest;

/**
 * Stops a running Google Compute Engine instance.
 *
 * @param string $projectId Project ID or project number of the Cloud project your instance belongs to.
 * @param string $zone Name of the zone your instance belongs to.
 * @param string $instanceName Name of the instance you want to stop.
  *
 * @throws \Google\ApiCore\ApiException if the remote call fails.
 * @throws \Google\ApiCore\ValidationException if local error occurs before remote call.
 */
function stop_instance(
    string $projectId,
    string $zone,
    string $instanceName
) {
    // Stop the Compute Engine instance using InstancesClient.
    $instancesClient = new InstancesClient();
    $request = (new StopInstanceRequest())
        ->setInstance($instanceName)
        ->setProject($projectId)
        ->setZone($zone);
    $operation = $instancesClient->stop($request);

    // Wait for the operation to complete.
    $operation->pollUntilComplete();
    if ($operation->operationSucceeded()) {
        printf('Instance %s stopped successfully' . PHP_EOL, $instanceName);
    } else {
        $error = $operation->getError();
        printf('Failed to stop instance: %s' . PHP_EOL, $error?->getMessage());
    }
}

Python

from __future__ import annotations

import sys
from typing import Any

from google.api_core.extended_operation import ExtendedOperation
from google.cloud import compute_v1


def wait_for_extended_operation(
    operation: ExtendedOperation, verbose_name: str = "operation", timeout: int = 300
) -> Any:
    """
    Waits for the extended (long-running) operation to complete.

    If the operation is successful, it will return its result.
    If the operation ends with an error, an exception will be raised.
    If there were any warnings during the execution of the operation
    they will be printed to sys.stderr.

    Args:
        operation: a long-running operation you want to wait on.
        verbose_name: (optional) a more verbose name of the operation,
            used only during error and warning reporting.
        timeout: how long (in seconds) to wait for operation to finish.
            If None, wait indefinitely.

    Returns:
        Whatever the operation.result() returns.

    Raises:
        This method will raise the exception received from `operation.exception()`
        or RuntimeError if there is no exception set, but there is an `error_code`
        set for the `operation`.

        In case of an operation taking longer than `timeout` seconds to complete,
        a `concurrent.futures.TimeoutError` will be raised.
    """
    result = operation.result(timeout=timeout)

    if operation.error_code:
        print(
            f"Error during {verbose_name}: [Code: {operation.error_code}]: {operation.error_message}",
            file=sys.stderr,
            flush=True,
        )
        print(f"Operation ID: {operation.name}", file=sys.stderr, flush=True)
        raise operation.exception() or RuntimeError(operation.error_message)

    if operation.warnings:
        print(f"Warnings during {verbose_name}:\n", file=sys.stderr, flush=True)
        for warning in operation.warnings:
            print(f" - {warning.code}: {warning.message}", file=sys.stderr, flush=True)

    return result


def stop_instance(project_id: str, zone: str, instance_name: str) -> None:
    """
    Stops a running Google Compute Engine instance.
    Args:
        project_id: project ID or project number of the Cloud project your instance belongs to.
        zone: name of the zone your instance belongs to.
        instance_name: name of the instance your want to stop.
    """
    instance_client = compute_v1.InstancesClient()

    operation = instance_client.stop(
        project=project_id, zone=zone, instance=instance_name
    )
    wait_for_extended_operation(operation, "instance stopping")

REST

์ธ์Šคํ„ด์Šค๋ฅผ ์ค‘์ง€ํ•˜๋ ค๋ฉด POST ์š”์ฒญ์„ instances.stop ๋ฉ”์„œ๋“œ์— ๋ณด๋ƒ…๋‹ˆ๋‹ค.

POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME/stop

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

  • INSTANCE_NAME: ์ธ์Šคํ„ด์Šค ์ด๋ฆ„์ž…๋‹ˆ๋‹ค.

  • PROJECT_ID: ์ธ์Šคํ„ด์Šค๊ฐ€ ์žˆ๋Š” ํ”„๋กœ์ ํŠธ์˜ ID์ž…๋‹ˆ๋‹ค.

  • ZONE: ์ธ์Šคํ„ด์Šค๊ฐ€ ์žˆ๋Š” ์˜์—ญ์ž…๋‹ˆ๋‹ค.

์„ ํƒ์ ์œผ๋กœ ์ธ์Šคํ„ด์Šค์—์„œ ๋‹จ๊ณ„์  ์ข…๋ฃŒ๋ฅผ ์‚ฌ์šฉ ์„ค์ •ํ•œ ๊ฒฝ์šฐ ์ธ์Šคํ„ด์Šค๋ฅผ ๋‹จ๊ณ„์ ์œผ๋กœ ์ข…๋ฃŒํ•˜์ง€ ์•Š๊ณ  ์ค‘์ง€ํ•˜๊ฑฐ๋‚˜ ์ง„ํ–‰ ์ค‘์ธ ๋‹จ๊ณ„์  ์ข…๋ฃŒ๋ฅผ ์ˆ˜๋™์œผ๋กœ ์ข…๋ฃŒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ ค๋ฉด POST ์š”์ฒญ์„ instances.stop ๋ฉ”์„œ๋“œ์— ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค. ์š”์ฒญ URL์— noGracefulShutdown=true ์ฟผ๋ฆฌ ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค.

POST https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/zones/ZONE/instances/VM_NAME/stop?noGracefulShutdown=true

๋กœ์ปฌ SSD ๋””์Šคํฌ๊ฐ€ ์žˆ๋Š” ์ธ์Šคํ„ด์Šค ์ค‘์ง€

์ปดํ“จํŒ… ์ธ์Šคํ„ด์Šค๋ฅผ ์ค‘์ง€ํ•  ๋•Œ ์ˆ˜ํ–‰ํ•˜๋ ค๋Š” ์ž‘์—…์— ๋”ฐ๋ผ ๋‹ค์Œ ์˜ต์…˜์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

  • ์ธ์Šคํ„ด์Šค์—์„œ ๋‹จ๊ณ„์  ์ข…๋ฃŒ๋ฅผ ์‚ฌ์šฉ ์„ค์ •ํ•œ ๊ฒฝ์šฐ Google Cloud ์ฝ˜์†”, gcloud CLI ๋˜๋Š” REST API๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋‹จ๊ณ„์  ์ข…๋ฃŒ ์—†์ด ์ธ์Šคํ„ด์Šค๋ฅผ ์ค‘๋‹จํ•˜๊ฑฐ๋‚˜ ์ง„ํ–‰ ์ค‘์ธ ๋‹จ๊ณ„์  ์ข…๋ฃŒ๋ฅผ ํ•ด์ œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • ์ธ์Šคํ„ด์Šค์— ์—ฐ๊ฒฐ๋œ ๋กœ์ปฌ SSD ๋””์Šคํฌ์˜ ๋ฐ์ดํ„ฐ๋ฅผ ๋ณด์กดํ•˜๋ ค๋ฉด(ํ‹ฐํƒ€๋Š„ SSD๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋จธ์‹  ์œ ํ˜• ์ œ์™ธ) gcloud CLI ๋˜๋Š” REST API๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ธ์Šคํ„ด์Šค๋ฅผ ์ค‘์ง€ํ•ฉ๋‹ˆ๋‹ค.

  • ์—ฌ๋Ÿฌ ์ธ์Šคํ„ด์Šค๋ฅผ ๋™์‹œ์— ์ค‘์ง€ํ•˜๋ ค๋ฉด Google Cloud ์ฝ˜์†”์„ ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜ ๋™์ผํ•œ ์˜์—ญ์— ์žˆ๋Š” ์ธ์Šคํ„ด์Šค์˜ ๊ฒฝ์šฐ gcloud CLI๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

๋กœ์ปฌ SSD ๋””์Šคํฌ๊ฐ€ ์—ฐ๊ฒฐ๋œ ํ•˜๋‚˜ ์ด์ƒ์˜ ์ธ์Šคํ„ด์Šค๋ฅผ ์ค‘์ง€ํ•˜๋ ค๋ฉด ๋‹ค์Œ ์˜ต์…˜ ์ค‘ ํ•˜๋‚˜๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

์ฝ˜์†”

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

    VM ์ธ์Šคํ„ด์Šค๋กœ ์ด๋™

  2. ์ค‘์ง€ํ•  ์‹คํ–‰ ์ค‘์ธ ์ธ์Šคํ„ด์Šค๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

  3. ์ค‘์ง€๋ฅผ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค. ์ค‘์ง€ ์˜ต์…˜์ด ์—†์œผ๋ฉด ์ž‘์—… ๋”๋ณด๊ธฐ > ์ค‘์ง€๋ฅผ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

  4. ๋Œ€ํ™”์ƒ์ž์—์„œ ๋‹ค์Œ์„ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.

    1. ์„ ํƒ์‚ฌํ•ญ: ์ธ์Šคํ„ด์Šค๋ฅผ ๋‹จ๊ณ„์ ์œผ๋กœ ์ข…๋ฃŒํ•˜์ง€ ์•Š๊ณ  ์ค‘์ง€ํ•˜๊ฑฐ๋‚˜ ์ง„ํ–‰ ์ค‘์ธ ๋‹จ๊ณ„์  ์ข…๋ฃŒ๋ฅผ ์ข…๋ฃŒํ•˜๋ ค๋ฉด ๋‹จ๊ณ„์  ์ข…๋ฃŒ ๊ฑด๋„ˆ๋›ฐ๊ธฐ(ํ•ด๋‹นํ•˜๋Š” ๊ฒฝ์šฐ) ์ฒดํฌ๋ฐ•์Šค๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

    2. ์ค‘์ง€๋ฅผ ํด๋ฆญํ•˜์—ฌ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

gcloud

๋กœ์ปฌ SSD ๋””์Šคํฌ๊ฐ€ ์—ฐ๊ฒฐ๋œ ๋™์ผํ•œ ์˜์—ญ์—์„œ ํ•˜๋‚˜ ์ด์ƒ์˜ ์ธ์Šคํ„ด์Šค๋ฅผ ์ค‘์ง€ํ•  ๋•Œ๋Š” ๋กœ์ปฌ SSD ๋ฐ์ดํ„ฐ๋ฅผ ์‚ญ์ œํ•˜๊ฑฐ๋‚˜ ๋ณด์กดํ• ์ง€ ์—ฌ๋ถ€๋ฅผ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค.

  • ๋กœ์ปฌ SSD ๋ฐ์ดํ„ฐ๋ฅผ ์‚ญ์ œํ•˜๋ ค๋ฉด --discard-local-ssd=true ํ”Œ๋ž˜๊ทธ์™€ ํ•จ๊ป˜ gcloud compute instances stop ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

    gcloud compute instances stop INSTANCE_NAMES \
        --discard-local-ssd=true \
        --zone=ZONE
    
  • ๋กœ์ปฌ SSD ๋ฐ์ดํ„ฐ๋ฅผ ๋ณด์กดํ•˜๋ ค๋ฉด --discard-local-ssd=false ํ”Œ๋ž˜๊ทธ์™€ ํ•จ๊ป˜ gcloud beta compute instances stop ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

    gcloud beta compute instances stop INSTANCE_NAMES \
        --discard-local-ssd=false \
        --zone=ZONE
    

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

  • INSTANCE_NAMES: ๊ณต๋ฐฑ์œผ๋กœ ๊ตฌ๋ถ„๋œ ์ธ์Šคํ„ด์Šค ์ด๋ฆ„ ๋ชฉ๋ก(์˜ˆ: instance-01 instance-02 instance-03)

  • ZONE: ์ธ์Šคํ„ด์Šค๊ฐ€ ์žˆ๋Š” ์˜์—ญ

์„ ํƒ์ ์œผ๋กœ ํ•˜๋‚˜ ์ด์ƒ์˜ ์ธ์Šคํ„ด์Šค์—์„œ ๋‹จ๊ณ„์  ์ข…๋ฃŒ๋ฅผ ์‚ฌ์šฉ ์„ค์ •ํ•œ ๊ฒฝ์šฐ ์ธ์Šคํ„ด์Šค๋ฅผ ๋‹จ๊ณ„์ ์œผ๋กœ ์ข…๋ฃŒํ•˜์ง€ ์•Š๊ณ  ์ค‘์ง€ํ•˜๊ฑฐ๋‚˜ ์ง„ํ–‰ ์ค‘์ธ ๋‹จ๊ณ„์  ์ข…๋ฃŒ๋ฅผ ์ข…๋ฃŒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ ค๋ฉด --no-graceful-shutdown ํ”Œ๋ž˜๊ทธ์™€ ํ•จ๊ป˜ gcloud beta compute instances stop ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

gcloud beta compute instances stop INSTANCE_NAMES \
    --discard-local-ssd=DISCARD_LOCAL_SSD \
    --no-graceful-shutdown \
    --zone=ZONE

DISCARD_LOCAL_SSD๋ฅผ true๋กœ ๋ฐ”๊ฟ” ๋กœ์ปฌ SSD ๋””์Šคํฌ์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์‚ญ์ œํ•˜๊ฑฐ๋‚˜ false๋กœ ๋ฐ”๊ฟ” ๋ฐ์ดํ„ฐ๋ฅผ ๋ณด์กดํ•ฉ๋‹ˆ๋‹ค.

REST

๋กœ์ปฌ SSD ๋””์Šคํฌ๊ฐ€ ์—ฐ๊ฒฐ๋œ ์ธ์Šคํ„ด์Šค๋ฅผ ์ค‘์ง€ํ•  ๋•Œ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋กœ์ปฌ SSD ๋ฐ์ดํ„ฐ๋ฅผ ์‚ญ์ œํ• ์ง€ ๋˜๋Š” ๋ณด์กดํ• ์ง€ ์—ฌ๋ถ€๋ฅผ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค.

  • ๋กœ์ปฌ SSD ๋ฐ์ดํ„ฐ๋ฅผ ์‚ญ์ œํ•˜๋ ค๋ฉด POST ์š”์ฒญ์„ instances.stop ๋ฉ”์„œ๋“œ์— ๋ณด๋ƒ…๋‹ˆ๋‹ค. ์š”์ฒญ URL์— true๋กœ ์„ค์ •๋œ discardLocalSsd ์ฟผ๋ฆฌ ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค.

    POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME/stop?discardLocalSsd=true
    
  • ๋กœ์ปฌ SSD ๋ฐ์ดํ„ฐ๋ฅผ ๋ณด์กดํ•˜๋ ค๋ฉด POST ์š”์ฒญ์„ beta.instances.stop ๋ฉ”์„œ๋“œ์— ๋ณด๋ƒ…๋‹ˆ๋‹ค. ์š”์ฒญ URL์— false๋กœ ์„ค์ •๋œ discardLocalSsd ์ฟผ๋ฆฌ ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค.

    POST https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME/stop?discardLocalSsd=false
    

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

  • PROJECT_ID: ์ธ์Šคํ„ด์Šค๊ฐ€ ์žˆ๋Š” ํ”„๋กœ์ ํŠธ์˜ ID์ž…๋‹ˆ๋‹ค.

  • ZONE: ์ธ์Šคํ„ด์Šค๊ฐ€ ์žˆ๋Š” ์˜์—ญ์ž…๋‹ˆ๋‹ค.

  • INSTANCE_NAME: ์ธ์Šคํ„ด์Šค ์ด๋ฆ„์ž…๋‹ˆ๋‹ค.

์„ ํƒ์ ์œผ๋กœ ์ธ์Šคํ„ด์Šค์—์„œ ๋‹จ๊ณ„์  ์ข…๋ฃŒ๋ฅผ ์‚ฌ์šฉ ์„ค์ •ํ•œ ๊ฒฝ์šฐ ๋‹จ๊ณ„์ ์œผ๋กœ ์ข…๋ฃŒํ•˜์ง€ ์•Š๊ณ  ์ธ์Šคํ„ด์Šค๋ฅผ ์ค‘์ง€ํ•˜๊ฑฐ๋‚˜ ์ง„ํ–‰ ์ค‘์ธ ๋‹จ๊ณ„์  ์ข…๋ฃŒ๋ฅผ ์ˆ˜๋™์œผ๋กœ ์ข…๋ฃŒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ ค๋ฉด POST ์š”์ฒญ์„ instances.stop ๋ฉ”์„œ๋“œ์— ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค. ์š”์ฒญ URL์— noGracefulShutdown=true ์ฟผ๋ฆฌ ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค.

POST https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/zones/ZONE/instances/VM_NAME/stop?discardLocalSsd=DISCARD_LOCAL_SSD&noGracefulShutdown=true

DISCARD_LOCAL_SSD๋ฅผ true๋กœ ๋ฐ”๊ฟ” ๋กœ์ปฌ SSD ๋””์Šคํฌ์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์‚ญ์ œํ•˜๊ฑฐ๋‚˜ false๋กœ ๋ฐ”๊ฟ” ๋ฐ์ดํ„ฐ๋ฅผ ๋ณด์กดํ•ฉ๋‹ˆ๋‹ค.

๊ฒŒ์ŠคํŠธ OS์—์„œ ์ธ์Šคํ„ด์Šค ์ค‘์ง€

์ปดํ“จํŒ… ์ธ์Šคํ„ด์Šค์— ๋กœ์ปฌ SSD ๋””์Šคํฌ๊ฐ€ ์—ฐ๊ฒฐ๋œ ๊ฒฝ์šฐ ๊ฒŒ์ŠคํŠธ OS๋ฅผ ์ข…๋ฃŒํ•˜๋ฉด ๋กœ์ปฌ SSD ๋ฐ์ดํ„ฐ๊ฐ€ ์ž๋™์œผ๋กœ ์‚ญ์ œ๋ฉ๋‹ˆ๋‹ค. ์ด ๋ฐ์ดํ„ฐ๋ฅผ ๋ณด์กดํ•˜๋ ค๋ฉด ์ธ์Šคํ„ด์Šค๋ฅผ ์ค‘์ง€ํ•˜๊ธฐ ์ „์— ๋ฐ์ดํ„ฐ๋ฅผ ์˜๊ตฌ ์ €์žฅ์†Œ ์˜ต์…˜์— ์ˆ˜๋™์œผ๋กœ ๋ณต์‚ฌํ•ฉ๋‹ˆ๋‹ค.

๊ฒŒ์ŠคํŠธ OS์—์„œ ์ธ์Šคํ„ด์Šค๋ฅผ ์ค‘์ง€ํ•˜๋ ค๋ฉด ๋‹ค์Œ ์˜ต์…˜ ์ค‘ ํ•˜๋‚˜๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

Linux

  1. ์•„์ง ์—ฐ๊ฒฐํ•˜์ง€ ์•Š์•˜๋‹ค๋ฉด ์ธ์Šคํ„ด์Šค์— ์—ฐ๊ฒฐํ•ฉ๋‹ˆ๋‹ค.

  2. ์ธ์Šคํ„ด์Šค๋ฅผ ์ค‘์ง€ํ•˜๋ ค๋ฉด ๋‹ค์Œ ๋ฐฉ๋ฒ• ์ค‘ ํ•˜๋‚˜๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

    • ๊ฒŒ์ŠคํŠธ OS๋ฅผ ์ข…๋ฃŒํ•˜๊ธฐ ์ „์— ์ธ์Šคํ„ด์Šค์—์„œ ์ข…๋ฃŒ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ—ˆ์šฉํ•˜๋Š” ์™„์ „ ์ข…๋ฃŒ์˜ ๊ฒฝ์šฐ ๋‹ค์Œ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

      sudo shutdown -h now
      
    • ๊ทธ๋ ‡์ง€ ์•Š์€ ๊ฒฝ์šฐ ๊ฐ•์ œ ์ข…๋ฃŒํ•˜๋ ค๋ฉด ๋‹ค์Œ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

      sudo poweroff
      

Windows

  1. ์•„์ง ์—ฐ๊ฒฐํ•˜์ง€ ์•Š์•˜๋‹ค๋ฉด ๋‹ค์Œ ๋ฐฉ๋ฒ• ์ค‘ ํ•˜๋‚˜๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ธ์Šคํ„ด์Šค์— ์—ฐ๊ฒฐํ•ฉ๋‹ˆ๋‹ค.

  2. ์ธ์Šคํ„ด์Šค๋ฅผ ์ค‘์ง€ํ•˜๋ ค๋ฉด ๋‹ค์Œ ๋ฐฉ๋ฒ• ์ค‘ ํ•˜๋‚˜๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

    • ์ธ์Šคํ„ด์Šค๋ฅผ ์™„์ „ํžˆ ์ค‘์ง€ํ•˜๊ณ  ๊ฒŒ์ŠคํŠธ OS๋ฅผ ์ข…๋ฃŒํ•˜๊ธฐ ์ „์— ์ธ์Šคํ„ด์Šค์—์„œ ์ข…๋ฃŒ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰ํ•˜๋„๋ก ํ•˜๋ ค๋ฉด ๋‹ค์Œ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

      shutdown /s
      
    • ๊ฐ•์ œ ์ข…๋ฃŒํ•˜๋ ค๋ฉด ๋‹ค์Œ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

      shutdown /f
      

์ธ์Šคํ„ด์Šค ๋‹ค์‹œ ์‹œ์ž‘

์ธ์Šคํ„ด์Šค ์ƒํƒœ๊ฐ€ TERMINATED์ธ ์™„์ „ํžˆ ์ค‘์ง€๋œ ์ปดํ“จํŒ… ์ธ์Šคํ„ด์Šค๋ฅผ ๋‹ค์‹œ ์‹œ์ž‘ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ธ์Šคํ„ด์Šค๋ฅผ ์ค‘์ง€ํ•  ๋•Œ ๋กœ์ปฌ SSD ๋””์Šคํฌ์˜ ๋ฐ์ดํ„ฐ๋ฅผ ๋ณด์กดํ•˜๋„๋ก ์„ ํƒํ•œ ๊ฒฝ์šฐ ์ธ์Šคํ„ด์Šค๋ฅผ ๋‹ค์‹œ ์‹œ์ž‘ํ•œ ํ›„ ๋กœ์ปฌ SSD ๋””์Šคํฌ๋ฅผ ๋‹ค์‹œ ๋งˆ์šดํŠธํ•ด์•ผ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋กœ์ปฌ SSD ๋””์Šคํฌ๋ฅผ ๋งˆ์šดํŠธํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๊ด€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ ๋กœ์ปฌ SSD ๊ธฐ๊ธฐ ํฌ๋งท ๋ฐ ๋งˆ์šดํŠธ๋ฅผ ์ฐธ๊ณ ํ•˜์„ธ์š”.

์ธ์Šคํ„ด์Šค๋ฅผ ๋‹ค์‹œ ์‹œ์ž‘ํ•˜๋ ค๋ฉด ์ธ์Šคํ„ด์Šค์— ์•”ํ˜ธํ™”๋œ ๋””์Šคํฌ๊ฐ€ ์—ฐ๊ฒฐ๋˜์—ˆ๋Š”์ง€ ์—ฌ๋ถ€์— ๋”ฐ๋ผ ๋‹ค์Œ ๋ฐฉ๋ฒ• ์ค‘ ํ•˜๋‚˜๋ฅผ ์‚ฌ์šฉํ•˜์„ธ์š”.

์•”ํ˜ธํ™”๋œ ๋””์Šคํฌ๊ฐ€ ์—†๋Š” ์ธ์Šคํ„ด์Šค ๋‹ค์‹œ ์‹œ์ž‘

์—ฌ๋Ÿฌ ์ปดํ“จํŒ… ์ธ์Šคํ„ด์Šค๋ฅผ ๋™์‹œ์— ๋‹ค์‹œ ์‹œ์ž‘ํ•˜๊ฑฐ๋‚˜ ๊ฐœ๋ณ„ ์ธ์Šคํ„ด์Šค๋ฅผ ๋‹ค์‹œ ์‹œ์ž‘ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์—ฌ๋Ÿฌ ์ธ์Šคํ„ด์Šค์˜ ๊ฒฝ์šฐ Google Cloud ์ฝ˜์†”์„ ์‚ฌ์šฉํ•˜๊ณ  ๋™์ผ ์˜์—ญ์— ์žˆ๋Š” ์ธ์Šคํ„ด์Šค์˜ ๊ฒฝ์šฐ gcloud CLI๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ๊ฐœ๋ณ„ ์ธ์Šคํ„ด์Šค์˜ ๊ฒฝ์šฐ ๋‹ค์Œ ์˜ต์…˜์„ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

์ฝ˜์†”

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

    VM ์ธ์Šคํ„ด์Šค๋กœ ์ด๋™

  2. ์ธ์Šคํ„ด์Šค๋ฅผ ํ•˜๋‚˜ ์ด์ƒ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

  3. ์‹œ์ž‘/์žฌ๊ฐœ๋ฅผ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

gcloud

๋™์ผํ•œ ์˜์—ญ์—์„œ ํ•˜๋‚˜ ์ด์ƒ์˜ ์ธ์Šคํ„ด์Šค๋ฅผ ๋‹ค์‹œ ์‹œ์ž‘ํ•˜๋ ค๋ฉด gcloud compute instances start ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

gcloud compute instances start INSTANCE_NAMES \
    --zone=ZONE

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

  • INSTANCE_NAMES: ๊ณต๋ฐฑ์œผ๋กœ ๊ตฌ๋ถ„๋œ ์ธ์Šคํ„ด์Šค ์ด๋ฆ„ ๋ชฉ๋ก(์˜ˆ: instance-01 instance-02 instance-03)

  • ZONE: ์ธ์Šคํ„ด์Šค๊ฐ€ ์žˆ๋Š” ์˜์—ญ

Go

import (
	"context"
	"fmt"
	"io"

	compute "cloud.google.com/go/compute/apiv1"
	computepb "cloud.google.com/go/compute/apiv1/computepb"
)

// startInstance starts a stopped Google Compute Engine instance (with unencrypted disks).
func startInstance(w io.Writer, projectID, zone, instanceName string) error {
	// projectID := "your_project_id"
	// zone := "europe-central2-b"
	// instanceName := "your_instance_name"

	ctx := context.Background()
	instancesClient, err := compute.NewInstancesRESTClient(ctx)
	if err != nil {
		return fmt.Errorf("NewInstancesRESTClient: %w", err)
	}
	defer instancesClient.Close()

	req := &computepb.StartInstanceRequest{
		Project:  projectID,
		Zone:     zone,
		Instance: instanceName,
	}

	op, err := instancesClient.Start(ctx, req)
	if err != nil {
		return fmt.Errorf("unable to start instance: %w", err)
	}

	if err = op.Wait(ctx); err != nil {
		return fmt.Errorf("unable to wait for the operation: %w", err)
	}

	fmt.Fprintf(w, "Instance started\n")

	return nil
}

์ž๋ฐ”


import com.google.api.gax.longrunning.OperationFuture;
import com.google.cloud.compute.v1.InstancesClient;
import com.google.cloud.compute.v1.Operation;
import com.google.cloud.compute.v1.Operation.Status;
import com.google.cloud.compute.v1.StartInstanceRequest;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

public class StartInstance {

  public static void main(String[] args)
      throws IOException, ExecutionException, InterruptedException, TimeoutException {
    // TODO(developer): Replace these variables before running the sample.
    /* project: project ID or project number of the Cloud project your instance belongs to.
       zone: name of the zone your instance belongs to.
       instanceName: name of the instance your want to start. */
    String project = "your-project-id";
    String zone = "zone-name";
    String instanceName = "instance-name";

    startInstance(project, zone, instanceName);
  }

  // Starts a stopped Google Compute Engine instance (with unencrypted disks).
  public static void startInstance(String project, String zone, String instanceName)
      throws IOException, ExecutionException, InterruptedException, TimeoutException {
    /* Initialize client that will be used to send requests. This client only needs to be created
       once, and can be reused for multiple requests. After completing all of your requests, call
       the `instancesClient.close()` method on the client to safely
       clean up any remaining background resources. */
    try (InstancesClient instancesClient = InstancesClient.create()) {

      // Create the request.
      StartInstanceRequest startInstanceRequest = StartInstanceRequest.newBuilder()
          .setProject(project)
          .setZone(zone)
          .setInstance(instanceName)
          .build();

      OperationFuture<Operation, Operation> operation = instancesClient.startAsync(
          startInstanceRequest);

      // Wait for the operation to complete.
      Operation response = operation.get(3, TimeUnit.MINUTES);

      if (response.getStatus() == Status.DONE) {
        System.out.println("Instance started successfully ! ");
      }
    }
  }
}

Node.js

/**
 * TODO(developer): Uncomment and replace these variables before running the sample.
 */
// const projectId = 'YOUR_PROJECT_ID';
// const zone = 'europe-central2-b'
// const instanceName = 'YOUR_INSTANCE_NAME'

const compute = require('@google-cloud/compute');

async function startInstance() {
  const instancesClient = new compute.InstancesClient();

  const [response] = await instancesClient.start({
    project: projectId,
    zone,
    instance: instanceName,
  });
  let operation = response.latestResponse;
  const operationsClient = new compute.ZoneOperationsClient();

  // Wait for the operation to complete.
  while (operation.status !== 'DONE') {
    [operation] = await operationsClient.wait({
      operation: operation.name,
      project: projectId,
      zone: operation.zone.split('/').pop(),
    });
  }

  console.log('Instance started.');
}

startInstance();

PHP

use Google\Cloud\Compute\V1\Client\InstancesClient;
use Google\Cloud\Compute\V1\StartInstanceRequest;

/**
 * Starts a stopped Google Compute Engine instance (with unencrypted disks).
 *
 * @param string $projectId Project ID or project number of the Cloud project your instance belongs to.
 * @param string $zone Name of the zone your instance belongs to.
 * @param string $instanceName Name of the instance you want to stop.
  *
 * @throws \Google\ApiCore\ApiException if the remote call fails.
 * @throws \Google\ApiCore\ValidationException if local error occurs before remote call.
 */
function start_instance(
    string $projectId,
    string $zone,
    string $instanceName
) {
    // Start the Compute Engine instance using InstancesClient.
    $instancesClient = new InstancesClient();
    $request = (new StartInstanceRequest())
        ->setInstance($instanceName)
        ->setProject($projectId)
        ->setZone($zone);
    $operation = $instancesClient->start($request);

    // Wait for the operation to complete.
    $operation->pollUntilComplete();
    if ($operation->operationSucceeded()) {
        printf('Instance %s started successfully' . PHP_EOL, $instanceName);
    } else {
        $error = $operation->getError();
        printf('Failed to start instance: %s' . PHP_EOL, $error?->getMessage());
    }
}

Python

from __future__ import annotations

import sys
from typing import Any

from google.api_core.extended_operation import ExtendedOperation
from google.cloud import compute_v1


def wait_for_extended_operation(
    operation: ExtendedOperation, verbose_name: str = "operation", timeout: int = 300
) -> Any:
    """
    Waits for the extended (long-running) operation to complete.

    If the operation is successful, it will return its result.
    If the operation ends with an error, an exception will be raised.
    If there were any warnings during the execution of the operation
    they will be printed to sys.stderr.

    Args:
        operation: a long-running operation you want to wait on.
        verbose_name: (optional) a more verbose name of the operation,
            used only during error and warning reporting.
        timeout: how long (in seconds) to wait for operation to finish.
            If None, wait indefinitely.

    Returns:
        Whatever the operation.result() returns.

    Raises:
        This method will raise the exception received from `operation.exception()`
        or RuntimeError if there is no exception set, but there is an `error_code`
        set for the `operation`.

        In case of an operation taking longer than `timeout` seconds to complete,
        a `concurrent.futures.TimeoutError` will be raised.
    """
    result = operation.result(timeout=timeout)

    if operation.error_code:
        print(
            f"Error during {verbose_name}: [Code: {operation.error_code}]: {operation.error_message}",
            file=sys.stderr,
            flush=True,
        )
        print(f"Operation ID: {operation.name}", file=sys.stderr, flush=True)
        raise operation.exception() or RuntimeError(operation.error_message)

    if operation.warnings:
        print(f"Warnings during {verbose_name}:\n", file=sys.stderr, flush=True)
        for warning in operation.warnings:
            print(f" - {warning.code}: {warning.message}", file=sys.stderr, flush=True)

    return result


def start_instance(project_id: str, zone: str, instance_name: str) -> None:
    """
    Starts a stopped Google Compute Engine instance (with unencrypted disks).
    Args:
        project_id: project ID or project number of the Cloud project your instance belongs to.
        zone: name of the zone your instance belongs to.
        instance_name: name of the instance your want to start.
    """
    instance_client = compute_v1.InstancesClient()

    operation = instance_client.start(
        project=project_id, zone=zone, instance=instance_name
    )

    wait_for_extended_operation(operation, "instance start")

REST

์ธ์Šคํ„ด์Šค๋ฅผ ๋‹ค์‹œ ์‹œ์ž‘ํ•˜๋ ค๋ฉด POST ์š”์ฒญ์„ instances.start ๋ฉ”์„œ๋“œ์— ๋ณด๋ƒ…๋‹ˆ๋‹ค.

 POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME/start

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

  • INSTANCE_NAME: ๋‹ค์‹œ ์‹œ์ž‘ํ•  ์ธ์Šคํ„ด์Šค์˜ ์ด๋ฆ„์ž…๋‹ˆ๋‹ค.

  • PROJECT_ID: ์ธ์Šคํ„ด์Šค๊ฐ€ ์žˆ๋Š” ํ”„๋กœ์ ํŠธ์˜ ID์ž…๋‹ˆ๋‹ค.

  • ZONE: ์ธ์Šคํ„ด์Šค๊ฐ€ ์žˆ๋Š” ์˜์—ญ์ž…๋‹ˆ๋‹ค.

์•”ํ˜ธํ™”๋œ ๋””์Šคํฌ๋กœ ์ธ์Šคํ„ด์Šค ๋‹ค์‹œ ์‹œ์ž‘

๊ณ ๊ฐ ์ œ๊ณต ์•”ํ˜ธํ™” ํ‚ค๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์•”ํ˜ธํ™”๋œ ๋””์Šคํฌ๊ฐ€ ์—ฐ๊ฒฐ๋œ ์ค‘์ง€๋œ ์ปดํ“จํŒ… ์ธ์Šคํ„ด์Šค๋ฅผ ๋‹ค์‹œ ์‹œ์ž‘ํ•  ๋•Œ๋Š” ์•”ํ˜ธํ™” ํ‚ค ์ •๋ณด๋ฅผ ์ œ๊ณตํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

์—ฌ๋Ÿฌ ์ธ์Šคํ„ด์Šค๋ฅผ ๋™์‹œ์— ๋‹ค์‹œ ์‹œ์ž‘ํ•˜๊ฑฐ๋‚˜ ๊ฐœ๋ณ„ ์ธ์Šคํ„ด์Šค๋ฅผ ๋‹ค์‹œ ์‹œ์ž‘ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์—ฌ๋Ÿฌ ์ธ์Šคํ„ด์Šค์˜ ๊ฒฝ์šฐ Google Cloud ์ฝ˜์†”์„ ์‚ฌ์šฉํ•˜๊ณ  ๋™์ผ ์˜์—ญ์— ์žˆ๋Š” ์ธ์Šคํ„ด์Šค์˜ ๊ฒฝ์šฐ gcloud CLI๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ๊ฐœ๋ณ„ ์ธ์Šคํ„ด์Šค์˜ ๊ฒฝ์šฐ ๋‹ค์Œ ์˜ต์…˜์„ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

์ฝ˜์†”

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

    VM ์ธ์Šคํ„ด์Šค๋กœ ์ด๋™

  2. ๋‹ค์‹œ ์‹œ์ž‘ํ•  ์ธ์Šคํ„ด์Šค๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

  3. ์‹œ์ž‘/์žฌ๊ฐœ๋ฅผ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

  4. ์ธ์Šคํ„ด์Šค์— ์—ฐ๊ฒฐ๋œ ๊ฐ ์•”ํ˜ธํ™”๋œ ๋””์Šคํฌ์— ๋Œ€ํ•œ ์•”ํ˜ธํ™” ํ‚ค๋ฅผ ์ง€์ •ํ•œ ๋‹ค์Œ ์‹œ์ž‘์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

gcloud

๋™์ผํ•œ ์˜์—ญ์—์„œ ์•”ํ˜ธํ™”๋œ ๋””์Šคํฌ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ํ•˜๋‚˜ ์ด์ƒ์˜ ์ธ์Šคํ„ด์Šค๋ฅผ ๋‹ค์‹œ ์‹œ์ž‘ํ•˜๋ ค๋ฉด --csek-key-file ํ”Œ๋ž˜๊ทธ์™€ ํ•จ๊ป˜ gcloud compute instances start ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. RSA ๋ž˜ํ•‘ ํ‚ค๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ --csek-key-file ํ”Œ๋ž˜๊ทธ์™€ ํ•จ๊ป˜ gcloud beta compute instances start ๋ช…๋ น์–ด๋ฅผ ๋Œ€์‹  ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

gcloud compute instances start INSTANCE_NAMES \
    --csek-key-file=ENCRYPTION_KEY_FILE \
    --zone=ZONE

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

  • INSTANCE_NAMES: ๊ณต๋ฐฑ์œผ๋กœ ๊ตฌ๋ถ„๋œ ์ธ์Šคํ„ด์Šค ์ด๋ฆ„ ๋ชฉ๋ก(์˜ˆ: instance-01 instance-02 instance-03)

  • ENCRYPTION_KEY_FILE: ๊ณ ๊ฐ ์ œ๊ณต ์•”ํ˜ธํ™” ํ‚ค๊ฐ€ ํฌํ•จ๋œ JSON ํŒŒ์ผ์˜ ์ƒ๋Œ€ ๊ฒฝ๋กœ์ž…๋‹ˆ๋‹ค. ์ธ์Šคํ„ด์Šค๊ฐ€ ๋™์ผํ•œ ๊ณ ๊ฐ ์ œ๊ณต ์•”ํ˜ธํ™” ํ‚ค๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ์—๋งŒ ์—ฌ๋Ÿฌ ์ธ์Šคํ„ด์Šค๋ฅผ ๋™์‹œ์— ๋‹ค์‹œ ์‹œ์ž‘ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • ZONE: ์ธ์Šคํ„ด์Šค๊ฐ€ ์žˆ๋Š” ์˜์—ญ

Go

import (
	"context"
	"fmt"
	"io"

	compute "cloud.google.com/go/compute/apiv1"
	computepb "cloud.google.com/go/compute/apiv1/computepb"
	"google.golang.org/protobuf/proto"
)

// startInstanceWithEncKey starts a stopped Google Compute Engine instance (with encrypted disks).
func startInstanceWithEncKey(w io.Writer, projectID, zone, instanceName, key string) error {
	// projectID := "your_project_id"
	// zone := "europe-central2-b"
	// instanceName := "your_instance_name"
	// key := "your_encryption_key"

	ctx := context.Background()
	instancesClient, err := compute.NewInstancesRESTClient(ctx)
	if err != nil {
		return fmt.Errorf("NewInstancesRESTClient: %w", err)
	}
	defer instancesClient.Close()

	instanceReq := &computepb.GetInstanceRequest{
		Project:  projectID,
		Zone:     zone,
		Instance: instanceName,
	}

	instance, err := instancesClient.Get(ctx, instanceReq)
	if err != nil {
		return fmt.Errorf("unable to get instance: %w", err)
	}

	req := &computepb.StartWithEncryptionKeyInstanceRequest{
		Project:  projectID,
		Zone:     zone,
		Instance: instanceName,
		InstancesStartWithEncryptionKeyRequestResource: &computepb.InstancesStartWithEncryptionKeyRequest{
			Disks: []*computepb.CustomerEncryptionKeyProtectedDisk{
				{
					Source: proto.String(instance.GetDisks()[0].GetSource()),
					DiskEncryptionKey: &computepb.CustomerEncryptionKey{
						RawKey: proto.String(key),
					},
				},
			},
		},
	}

	op, err := instancesClient.StartWithEncryptionKey(ctx, req)
	if err != nil {
		return fmt.Errorf("unable to start instance with encryption key: %w", err)
	}

	if err = op.Wait(ctx); err != nil {
		return fmt.Errorf("unable to wait for the operation: %w", err)
	}

	fmt.Fprintf(w, "Instance with encryption key started\n")

	return nil
}

์ž๋ฐ”


import com.google.api.gax.longrunning.OperationFuture;
import com.google.cloud.compute.v1.CustomerEncryptionKey;
import com.google.cloud.compute.v1.CustomerEncryptionKeyProtectedDisk;
import com.google.cloud.compute.v1.GetInstanceRequest;
import com.google.cloud.compute.v1.Instance;
import com.google.cloud.compute.v1.InstancesClient;
import com.google.cloud.compute.v1.InstancesStartWithEncryptionKeyRequest;
import com.google.cloud.compute.v1.Operation;
import com.google.cloud.compute.v1.Operation.Status;
import com.google.cloud.compute.v1.StartWithEncryptionKeyInstanceRequest;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

public class StartEncryptedInstance {

  public static void main(String[] args)
      throws IOException, ExecutionException, InterruptedException, TimeoutException {
    // TODO(developer): Replace these variables before running the sample.
    /* project: project ID or project number of the Cloud project your instance belongs to.
       zone: name of the zone your instance belongs to.
       instanceName: name of the instance your want to start.
       key: bytes object representing a raw base64 encoded key to your machines boot disk.
            For more information about disk encryption see:
            https://cloud.google.com/compute/docs/disks/customer-supplied-encryption#specifications
     */
    String project = "your-project-id";
    String zone = "zone-name";
    String instanceName = "instance-name";
    String key = "raw-key";

    startEncryptedInstance(project, zone, instanceName, key);
  }

  // Starts a stopped Google Compute Engine instance (with encrypted disks).
  public static void startEncryptedInstance(String project, String zone, String instanceName,
      String key)
      throws IOException, ExecutionException, InterruptedException, TimeoutException {
    /* Initialize client that will be used to send requests. This client only needs to be created
       once, and can be reused for multiple requests. After completing all of your requests, call
       the `instancesClient.close()` method on the client to safely
       clean up any remaining background resources. */
    try (InstancesClient instancesClient = InstancesClient.create()) {

      GetInstanceRequest getInstanceRequest = GetInstanceRequest.newBuilder()
          .setProject(project)
          .setZone(zone)
          .setInstance(instanceName).build();

      Instance instance = instancesClient.get(getInstanceRequest);

      // Prepare the information about disk encryption.
      CustomerEncryptionKeyProtectedDisk protectedDisk = CustomerEncryptionKeyProtectedDisk
          .newBuilder()
          /* Use raw_key to send over the key to unlock the disk
             To use a key stored in KMS, you need to provide:
             `kms_key_name` and `kms_key_service_account`
           */
          .setDiskEncryptionKey(CustomerEncryptionKey.newBuilder()
              .setRawKey(key).build())
          .setSource(instance.getDisks(0).getSource())
          .build();

      InstancesStartWithEncryptionKeyRequest startWithEncryptionKeyRequest =
          InstancesStartWithEncryptionKeyRequest.newBuilder()
              .addDisks(protectedDisk).build();

      StartWithEncryptionKeyInstanceRequest encryptionKeyInstanceRequest =
          StartWithEncryptionKeyInstanceRequest.newBuilder()
              .setProject(project)
              .setZone(zone)
              .setInstance(instanceName)
              .setInstancesStartWithEncryptionKeyRequestResource(startWithEncryptionKeyRequest)
              .build();

      OperationFuture<Operation, Operation> operation = instancesClient.startWithEncryptionKeyAsync(
          encryptionKeyInstanceRequest);
      Operation response = operation.get(3, TimeUnit.MINUTES);

      if (response.getStatus() == Status.DONE) {
        System.out.println("Encrypted instance started successfully ! ");
      }
    }
  }

}

Node.js

/**
 * TODO(developer): Uncomment and replace these variables before running the sample.
 */
// const projectId = 'YOUR_PROJECT_ID';
// const zone = 'europe-central2-b'
// const instanceName = 'YOUR_INSTANCE_NAME'
// const key = 'YOUR_KEY_STRING'

const compute = require('@google-cloud/compute');

async function startInstanceWithEncryptionKey() {
  const instancesClient = new compute.InstancesClient();

  const [instance] = await instancesClient.get({
    project: projectId,
    zone,
    instance: instanceName,
  });

  const [response] = await instancesClient.startWithEncryptionKey({
    project: projectId,
    zone,
    instance: instanceName,
    instancesStartWithEncryptionKeyRequestResource: {
      disks: [
        {
          source: instance.disks[0].source,
          diskEncryptionKey: {
            rawKey: key,
          },
        },
      ],
    },
  });
  let operation = response.latestResponse;
  const operationsClient = new compute.ZoneOperationsClient();

  // Wait for the operation to complete.
  while (operation.status !== 'DONE') {
    [operation] = await operationsClient.wait({
      operation: operation.name,
      project: projectId,
      zone: operation.zone.split('/').pop(),
    });
  }

  console.log('Instance with encryption key started.');
}

startInstanceWithEncryptionKey();

PHP

use Google\Cloud\Compute\V1\Client\InstancesClient;
use Google\Cloud\Compute\V1\CustomerEncryptionKey;
use Google\Cloud\Compute\V1\CustomerEncryptionKeyProtectedDisk;
use Google\Cloud\Compute\V1\GetInstanceRequest;
use Google\Cloud\Compute\V1\InstancesStartWithEncryptionKeyRequest;
use Google\Cloud\Compute\V1\StartWithEncryptionKeyInstanceRequest;

/**
 * Starts a stopped Google Compute Engine instance (with encrypted disks).
 *
 * @param string $projectId Project ID or project number of the Cloud project your instance belongs to.
 * @param string $zone Name of the zone your instance belongs to.
 * @param string $instanceName Name of the instance you want to stop.
 * @param string $key Bytes object representing a raw base64 encoded key to your instance's boot disk.
 *                    For more information about disk encryption see:
 *                    https://cloud.google.com/compute/docs/disks/customer-supplied-encryption#specifications
 *
 * @throws \Google\ApiCore\ApiException if the remote call fails.
 * @throws \Google\ApiCore\ValidationException if local error occurs before remote call.
 */
function start_instance_with_encryption_key(
    string $projectId,
    string $zone,
    string $instanceName,
    string $key
) {
    // Initiate the InstancesClient.
    $instancesClient = new InstancesClient();

    // Get data about the instance.
    $request = (new GetInstanceRequest())
        ->setInstance($instanceName)
        ->setProject($projectId)
        ->setZone($zone);
    $instanceData = $instancesClient->get($request);

    // Use `setRawKey` to send over the key to unlock the disk
    // To use a key stored in KMS, you need to use `setKmsKeyName` and `setKmsKeyServiceAccount`
    $customerEncryptionKey = (new CustomerEncryptionKey())
        ->setRawKey($key);

    /** @var \Google\Cloud\Compute\V1\AttachedDisk */
    $disk = $instanceData->getDisks()[0];

    // Prepare the information about disk encryption.
    $diskData = (new CustomerEncryptionKeyProtectedDisk())
        ->setSource($disk->getSource())
        ->setDiskEncryptionKey($customerEncryptionKey);

    // Set request with one disk.
    $instancesStartWithEncryptionKeyRequest = (new InstancesStartWithEncryptionKeyRequest())
        ->setDisks(array($diskData));

    // Start the instance with encrypted disk.
    $request2 = (new StartWithEncryptionKeyInstanceRequest())
        ->setInstance($instanceName)
        ->setInstancesStartWithEncryptionKeyRequestResource($instancesStartWithEncryptionKeyRequest)
        ->setProject($projectId)
        ->setZone($zone);
    $operation = $instancesClient->startWithEncryptionKey($request2);

    // Wait for the operation to complete.
    $operation->pollUntilComplete();
    if ($operation->operationSucceeded()) {
        printf('Instance %s started successfully' . PHP_EOL, $instanceName);
    } else {
        $error = $operation->getError();
        printf('Starting instance failed: %s' . PHP_EOL, $error?->getMessage());
    }
}

Python

from __future__ import annotations

import sys
from typing import Any

from google.api_core.extended_operation import ExtendedOperation
from google.cloud import compute_v1


def wait_for_extended_operation(
    operation: ExtendedOperation, verbose_name: str = "operation", timeout: int = 300
) -> Any:
    """
    Waits for the extended (long-running) operation to complete.

    If the operation is successful, it will return its result.
    If the operation ends with an error, an exception will be raised.
    If there were any warnings during the execution of the operation
    they will be printed to sys.stderr.

    Args:
        operation: a long-running operation you want to wait on.
        verbose_name: (optional) a more verbose name of the operation,
            used only during error and warning reporting.
        timeout: how long (in seconds) to wait for operation to finish.
            If None, wait indefinitely.

    Returns:
        Whatever the operation.result() returns.

    Raises:
        This method will raise the exception received from `operation.exception()`
        or RuntimeError if there is no exception set, but there is an `error_code`
        set for the `operation`.

        In case of an operation taking longer than `timeout` seconds to complete,
        a `concurrent.futures.TimeoutError` will be raised.
    """
    result = operation.result(timeout=timeout)

    if operation.error_code:
        print(
            f"Error during {verbose_name}: [Code: {operation.error_code}]: {operation.error_message}",
            file=sys.stderr,
            flush=True,
        )
        print(f"Operation ID: {operation.name}", file=sys.stderr, flush=True)
        raise operation.exception() or RuntimeError(operation.error_message)

    if operation.warnings:
        print(f"Warnings during {verbose_name}:\n", file=sys.stderr, flush=True)
        for warning in operation.warnings:
            print(f" - {warning.code}: {warning.message}", file=sys.stderr, flush=True)

    return result


def start_instance_with_encryption_key(
    project_id: str, zone: str, instance_name: str, key: bytes
) -> None:
    """
    Starts a stopped Google Compute Engine instance (with encrypted disks).
    Args:
        project_id: project ID or project number of the Cloud project your instance belongs to.
        zone: name of the zone your instance belongs to.
        instance_name: name of the instance your want to start.
        key: bytes object representing a raw base64 encoded key to your machines boot disk.
            For more information about disk encryption see:
            https://cloud.google.com/compute/docs/disks/customer-supplied-encryption#specifications
    """
    instance_client = compute_v1.InstancesClient()

    instance_data = instance_client.get(
        project=project_id, zone=zone, instance=instance_name
    )

    # Prepare the information about disk encryption
    disk_data = compute_v1.CustomerEncryptionKeyProtectedDisk()
    disk_data.source = instance_data.disks[0].source
    disk_data.disk_encryption_key = compute_v1.CustomerEncryptionKey()
    # Use raw_key to send over the key to unlock the disk
    # To use a key stored in KMS, you need to provide `kms_key_name` and `kms_key_service_account`
    disk_data.disk_encryption_key.raw_key = key
    enc_data = compute_v1.InstancesStartWithEncryptionKeyRequest()
    enc_data.disks = [disk_data]

    operation = instance_client.start_with_encryption_key(
        project=project_id,
        zone=zone,
        instance=instance_name,
        instances_start_with_encryption_key_request_resource=enc_data,
    )

    wait_for_extended_operation(operation, "instance start (with encrypted disk)")

REST

์•”ํ˜ธํ™”๋œ ๋””์Šคํฌ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ์ธ์Šคํ„ด์Šค๋ฅผ ๋‹ค์‹œ ์‹œ์ž‘ํ•˜๋ ค๋ฉด instances.startWithEncryptionKey ๋ฉ”์„œ๋“œ์— POST ์š”์ฒญ์„ ๋ณด๋ƒ…๋‹ˆ๋‹ค.

POST  https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME/startWithEncryptionKey

{
  "disks": [
    {
      "source": "DISK_URL",
      "diskEncryptionKey": {
        "ENCRYPTION_TYPE": "ENCRYPTION_KEY"
      }
    }
  ]
}

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

  • PROJECT_ID: ์ธ์Šคํ„ด์Šค๊ฐ€ ์žˆ๋Š” ํ”„๋กœ์ ํŠธ์˜ ID์ž…๋‹ˆ๋‹ค.

  • ZONE: ์ธ์Šคํ„ด์Šค๊ฐ€ ์žˆ๋Š” ์˜์—ญ์ž…๋‹ˆ๋‹ค.

  • INSTANCE_NAME: ์ธ์Šคํ„ด์Šค ์ด๋ฆ„์ž…๋‹ˆ๋‹ค.

  • DISK_URL: ๊ณ ๊ฐ ์ œ๊ณต ์•”ํ˜ธํ™” ํ‚ค๋กœ ์•”ํ˜ธํ™”๋œ ์—ฐ๊ฒฐ ๋””์Šคํฌ์˜ ์ „์ฒด ๋ฆฌ์†Œ์Šค ์ด๋ฆ„์— ํ•ด๋‹นํ•˜๋Š” ๋ฆฌ์†Œ์Šค URL์ž…๋‹ˆ๋‹ค.

  • ENCRYPTION_TYPE: ์‚ฌ์šฉ ์ค‘์ธ ๋””์Šคํฌ ์•”ํ˜ธํ™” ์œ ํ˜•์ด๋ฉฐ ๋‹ค์Œ rawKey, kmsKeyName, rsaEncryptedKey ์ค‘ ํ•˜๋‚˜์ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. rsaEncryptedKey ์œ ํ˜•์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ beta.instances.startWithEncryptionKey ๋ฉ”์„œ๋“œ์— POST ์š”์ฒญ์„ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.

  • ENCRYPTION_KEY: ์ธ์Šคํ„ด์Šค์— ์—ฐ๊ฒฐ๋œ ์˜๊ตฌ ๋””์Šคํฌ๋ฅผ ์•”ํ˜ธํ™”ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋˜๋Š” ์•”ํ˜ธํ™” ํ‚ค์ž…๋‹ˆ๋‹ค. rawKey ๋˜๋Š” rsaEncryptedKey ํ‚ค๋Š” base64๋กœ ์ธ์ฝ”๋”ฉ๋˜์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๋˜ํ•œ rsaEncryptedKey ํ‚ค๋ฅผ ์ค€๋น„ํ•˜๋ ค๋ฉด RSA ํ‚ค ๋ž˜ํ•‘์„ ์ฐธ๊ณ ํ•˜์„ธ์š”.

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