Cloud Shell로 gcloud 명령어 실행

Cloud Shell에서 gcloud CLI 명령어를 실행하는 방법을 알아봅니다.

시작하기 전에

  1. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  2. Verify that billing is enabled for your Google Cloud project.

gcloud 속성 설정

  1. Cloud Shell 편집기를 실행합니다.
  2. 코어 속성을 설정하여 메시지를 터미널로 출력할 때 색상이 사용되지 않도록 합니다.

    gcloud config set disable_color true
    
  3. disable_color 속성을 설정 해제합니다.

    gcloud config unset disable_color
    
  4. Compute Engine API를 사용 설정했으면 원하는 Compute Engine 리전을 설정합니다. REGION을 리전 이름으로 바꿉니다(예: us-east1).

    gcloud config set compute/region REGION
    

    또는 원하는 영역을 설정할 수 있습니다. ZONE을 영역 이름으로 바꿉니다(예: us-east1-b).

    gcloud config set compute/zone ZONE
    

    Compute Engine 리전 및 영역에 대한 자세한 내용은 리전 및 영역을 참조하세요.

  5. 사용 가능한 속성 목록을 표시합니다.

    gcloud topic configurations
    

코어 명령어 실행

  1. 사용자 인증 정보가 로컬 시스템에 저장된 계정을 나열합니다.

    gcloud auth list
    

    gcloud CLI는 사용자 인증 정보 계정 목록을 표시합니다. 여기서 ACCOUNT_EMAIL은 하나 이상의 활성 계정 목록을 나타냅니다.

    Credentialed Accounts
    ACTIVE  ACCOUNT
    \*      ACCOUNT_EMAIL
    
  2. 활성 gcloud CLI 구성의 속성을 나열합니다.

    gcloud config list
    

    gcloud CLI는 다음과 유사한 속성 목록을 표시합니다. 여기서 PROJECT_IDACCOUNT_EMAIL는 이메일 및 프로젝트 ID를 표시합니다.

    [core]
    account = ACCOUNT_EMAIL
    disable_usage_reporting = False
    project = PROJECT_ID
    
  3. gcloud CLI 설치 및 활성 구성에 대한 정보를 봅니다.

    gcloud info
    

gcloud 명령어의 도움말 보기

  1. gcloud compute instances create 명령어의 도움말을 봅니다.

    gcloud help compute instances create
    
  2. gcloud topic에서 사용 가능한 명령어를 봅니다.

    gcloud help topic
    
  3. 필터링에 대한 정보를 봅니다.

    gcloud topic filters
    
  4. gcloud 명령어 구조에 대해 자세히 알아봅니다.

    gcloud topic command-conventions
    

다음 단계