[GCP] GCLOUD 명령어

cch_chan·2022년 9월 16일
0

GCP

목록 보기
7/14

ubuntu gcloud 설치 명령어

gcloud 설치

curl https://sdk.cloud.google.com | bash
# gcloud 초기화
exec -l $SHELL
gcloud init

gcloud 로그인 인증
gcloud auth login
계정 리스트 확인
gcloud auth list

접근 가능한 프로젝트 목록 확인
gcloud project list

gcloud 환경설정

gcloud config set compute/region [region]
gcloud config set compute/zone [zone]

VM

vm 생성

gcloud compute instances create VM_NAME \
    [--image IMAGE | --image-family IMAGE_FAMILY] \
    --image-project IMAGE_PROJECT

머신 리스트 확인
gcloud compute instances list

메타데이터포함 (apache2 설치)

	gcloud compute instances create www1 \
   --zone=us-west4-c \
   --tags=network-lb-tag \
   --machine-type=e2-medium \
   --image-family=debian-11 \
   --image-project=debian-cloud \
   --metadata=startup-script='#!/bin/bash
     apt-get update
     apt-get install apache2 -y
     service apache2 restart
     echo "
<h3>Web Server: www1</h3>" | tee /var/www/html/index.html'

Loadballancer

gcloud compute addresses create network-lb-ip-1 \
 --region us-west4 

GCS

버킷 생성 : gsutil mb -p [PROJECT_ID] gs://[BUCKET_NAME]

Pub/Sub

메시지 불러오기 : gcloud pubsub subscriptions pull --auto-ack [sub_NAME]

profile
꾸준히 새로운 기술을 배워나가는중입니다.

0개의 댓글