Spot VM を作成して使用する
https://cloud.google.com/compute/docs/instances/spot?hl=ja
最も安価と思われるサイズ
e2-micro
vCPU=0.25~2 RAM=1GB
1530円/月(スポットでない場合)
725円/月(スポットの場合)
-- 1. 前作業
gcloud init
gcloud auth list
gcloud --version
gcloud projects create project01-9999999 \
--name="project01"
gcloud projects list
gcloud config list
gcloud config set project project01-9999999
gcloud config set compute/region asia-northeast1
gcloud config set compute/zone asia-northeast1-a
gcloud services enable compute.googleapis.com
gcloud compute instances create vm01 \
--project=project01-9999999 \
--zone=asia-northeast1-a \
--machine-type=e2-micro \
--image-project=centos-cloud \
--image=centos-7-v20221004 \
--network-interface=network-tier=STANDARD \
--provisioning-model=SPOT \
--instance-termination-action=DELETE
gcloud compute instances list
gcloud compute instances describe vm01
gcloud compute instances describe vm01 | grep -e provisioningModel -e instanceTerminationAction
gcloud compute ssh vm01
gcloud compute instances stop vm01
gcloud compute instances start vm01
gcloud compute instances describe vm01
-- 4. クリーンアップ
gcloud projects list
gcloud projects delete project01-9999999