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 config set compute/region [region]
gcloud config set compute/zone [zone]
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'
gcloud compute addresses create network-lb-ip-1 \
--region us-west4
버킷 생성 : gsutil mb -p [PROJECT_ID] gs://[BUCKET_NAME]
메시지 불러오기 : gcloud pubsub subscriptions pull --auto-ack [sub_NAME]