最初に認証キー作ってからでないとだめ
サービス アカウントとして認証する | Google Cloud
Python 用の Cloud クライアント ライブラリの使用 | Compute Engine ドキュメント | Google Cloud
python3 -m pip install --upgrade google-api-python-client
python-docs-samples/create_instance.py at master · GoogleCloudPlatform/python-docs-samples
動作テストにこのgithubのコード使った
※そのまま動かすとインスタンスの料金かかるのでそこはコメントアウト推奨。
備考
- JSON形式のキーの生成はブラウザが楽、SSHクライアントでファイル移せば良いから(筆者はRLoginで移した
- 権限関係の問題と、プロジェクト名でコマンド打ってたからずっと認識されなかった。そりゃそうだ。
これで
自宅のRaspberryPiからGCPのインスタンスの起動が出来るぞ!!!
やったー