Quantcast
Channel: Node.jsタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 8691

Node.jsでGCEのインスタンスを作成・削除する

$
0
0

作成

constCompute=require('@google-cloud/compute');constcompute=newCompute();constoption={..........};constzone=compute.zone('asia-northeast1-b');const[vm,operation]=awaitzone.createVM(vmName,option);awaitoperation.promise();console.log(vmName+' created!');

option の中身はGCPのコンソールでポチポチやった時のパラメータ(下記参照)をコピーして使うと良い

image.png

image.png

削除

constcompute=newCompute();constzone=compute.zone('asia-northeast1-b');constvm=awaitzone.vm(vmName);const[operation]=awaitvm.delete();awaitoperation.promise();console.log(vmName+' deleted!');

Viewing all articles
Browse latest Browse all 8691

Trending Articles