Google cloud gcloud

From 탱이의 잡동사니
Jump to: navigation, search

Overview

gcloud 내용 정리.

gcloud wide flags

gcloud 전역에서 사용되는 flag 정리.

--account

Google cloud platform user account to use for invocation. Overrides the default core/account property value for this command invocation.

--account=ACCOUNT

--project

The google cloud platform project name to use for this invocation. If omitted, then the current project is assumed; the current project can be listed using `gcloud config list --format='text(core.project)'` and can be set using `gcloud config set project PROJECTID`. Overrides the default core/project property value for this command invocation.

프로젝트를 설정한다.

--project=PROJECT_ID

compute

Create and manipulate google compute engine resources.

gcloud compute GROUP | COMMAND [GCLOUD_WIDE_FLAG ...]

compute instances

Read and manipulate Google Compute Engine virtual machine instances

gcloud compute instances GROUP | COMMAND [GCLOUD_WIDE_FLAG ...]

list

설정된 모든 compute engine instance 를 보여준다.

List google compute engine instances. Displays all google compute engine instances in a project.

By default, instances from all zones are listed. The results can be narrowed down using a filter: --filter="zone:(Zone ...)".

gcloud compute instances list [NAME ...] [--regexp=REGEXP, -r REGEXP]
        [--zones=ZONE,[ZONE,...]] [--filter=EXPRESSION] [--limit=LIMIT]
        [--page-size=PAGE_SIZE] [--sort-by=[FIELD,...]] [--uri]
        [GCLOUD_WIDE_FLAG ...]
Example
$ gcloud compute instances list --project smiling-axiom-2195
NAME           ZONE            MACHINE_TYPE  PREEMPTIBLE  INTERNAL_IP  EXTERNAL_IP    STATUS
test-instance  europe-west4-a  g1-small                   10.164.0.2   35.204.231.99  RUNNING

compute ssh

지정한 instance 로 ssh 접속을 한다.

gcloud compute ssh --project smiling-axiom-2195 test-instance

See also