{GCP Cloud Bigtable}cbt CLI でインスタンスを作成してデータを書き込む

 


https://cloud.google.com/bigtable/docs/create-instance-write-data-cbt-cli?hl=ja

https://cloud.google.com/bigtable/docs/creating-instance?hl=ja#cbt
https://cloud.google.com/bigtable/docs/cbt-reference?hl=ja

 

ノードあたり $0.85/時間(最小 1 ノード)


SSD ストレージ(GB/月)$0.22
HDD ストレージ(GB/月)$0.034
Bigtable では、Bigtable テーブルの平均データ量が短い間隔で頻繁に測定されます。
料金請求には、この測定値の 1 か月間の平均値が算出され、この平均値に月額単価が掛けられます。


-- 1. 前作業

gcloud init
gcloud auth list

gcloud --version

gcloud projects create project01-9999999 \
--name="project01"

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. Cloud Bigtable と Cloud Bigtable Admin API を有効にする

gcloud services list --enabled

gcloud services enable bigtable.googleapis.com bigtableadmin.googleapis.com


-- 3. cbt CLI をインストール
gcloud components install cbt

cbt help
cbt version

-- 4. Bigtable インスタンスを作成

cbt createinstance instance01 \
"instance01" \
cluster01 \
asia-northeast1-a \
1 \
HDD


cbt -project project01-9999999 \
listinstances

cbt -project project01-9999999 -instance instance01 \
listclusters

 


-- 5. 動作確認

cbt -project project01-9999999 -instance instance01 \
createtable tab1

cbt -project project01-9999999 -instance instance01 \
ls

cbt -project project01-9999999 -instance instance01 \
createfamily tab1 colf1

cbt -project project01-9999999 -instance instance01 \
ls tab1

cbt -project project01-9999999 -instance instance01 \
set tab1 r1 colf1:c1=v1

cbt -project project01-9999999 -instance instance01 \
read tab1

cbt -project project01-9999999 -instance instance01 \
count tab1

 

-- 6. クリーンアップ

cbt -project project01-9999999 -instance instance01 \
deletetable tab1

cbt -project project01-9999999 -instance instance01 \
deleteinstance instance01

 

gcloud projects list

gcloud projects delete project01-9999999