{GCP Memorystore for Redis}gcloud CLI を使用して Memorystore for Redis インスタンスを作成する

 

https://cloud.google.com/memorystore/docs/redis/create-instance-gcloud?hl=ja


Basic 1GB 209円/1日


-- 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 --quiet
gcloud config set compute/zone asia-northeast1-a --quiet

gcloud beta billing accounts list
gcloud beta billing projects link project01-9999999 --billing-account=111111-111111-111111

gcloud services enable compute.googleapis.com --project project01-9999999

gcloud components update


-- 2. Memorystore for Redis インスタンスの作成


gcloud services list --enabled

gcloud services enable redis.googleapis.com

 

gcloud redis instances create redis01 \
--display-name=redis01 \
--size=1 \
--tier=basic \
--region=asia-northeast1 \
--redis-version=redis_6_x

 

gcloud redis instances list

 

gcloud redis instances describe redis01 \
--region=asia-northeast1

 

-- 3. 動作確認

gcloud compute instances create vm01 \
--project=project01-9999999 \
--zone=asia-northeast1-a \
--machine-type=e2-micro \
--image-family debian-10 \
--image-project debian-cloud \
--network-interface=network-tier=STANDARD \
--provisioning-model=SPOT \
--instance-termination-action=DELETE


gcloud compute instances list

gcloud compute ssh vm01


sudo apt install telnet

telnet 192.0.2.1 6379

PING

SET HELLO WORLD

GET HELLO

 

-- 4. クリーンアップ


gcloud projects list

gcloud projects delete project01-9999999