jpskill.com
🛠️ 開発・MCP コミュニティ

gcloud

Google Cloudの様々なサービス(Compute Engine、Cloud Storage、Cloud Functionsなど)を、ターミナルから操作・管理したい場合に、コマンドラインツールを使って効率的に作業を進めるSkill。

📜 元の英語説明(参考)

Google Cloud CLI for managing GCP resources. Use when the user needs to work with Compute Engine, Cloud Storage, Cloud Functions, IAM, GKE, and other Google Cloud services from the terminal.

🇯🇵 日本人クリエイター向け解説

一言でいうと

Google Cloudの様々なサービス(Compute Engine、Cloud Storage、Cloud Functionsなど)を、ターミナルから操作・管理したい場合に、コマンドラインツールを使って効率的に作業を進めるSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o gcloud.zip https://jpskill.com/download/14923.zip && unzip -o gcloud.zip && rm gcloud.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/14923.zip -OutFile "$d\gcloud.zip"; Expand-Archive "$d\gcloud.zip" -DestinationPath $d -Force; ri "$d\gcloud.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して gcloud.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → gcloud フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Google Cloud CLI

gcloud CLI は、ターミナルから GCP リソース、構成、およびデプロイメントを管理します。

セットアップ

# gcloud CLI のインストール
curl https://sdk.cloud.google.com | bash
exec -l $SHELL

# 初期化と認証
gcloud init
gcloud auth login
gcloud auth application-default login

# プロジェクトとリージョンの設定
gcloud config set project my-project-id
gcloud config set compute/region us-central1
gcloud config set compute/zone us-central1-a

# 複数のプロジェクトに対する名前付き構成
gcloud config configurations create production
gcloud config configurations activate production

Compute Engine

# VM インスタンスの作成
gcloud compute instances create web-server \
  --machine-type=e2-medium \
  --image-family=ubuntu-2204-lts \
  --image-project=ubuntu-os-cloud \
  --boot-disk-size=30GB \
  --boot-disk-type=pd-ssd \
  --subnet=my-subnet \
  --tags=http-server,https-server \
  --service-account=app-sa@my-project.iam.gserviceaccount.com

# インスタンスの一覧表示
gcloud compute instances list \
  --filter="status=RUNNING AND labels.env=production" \
  --format="table(name,zone,machineType.basename(),networkInterfaces[0].accessConfigs[0].natIP)"

# インスタンスへの SSH 接続
gcloud compute ssh web-server --zone=us-central1-a

# 停止/開始/削除
gcloud compute instances stop web-server --zone=us-central1-a
gcloud compute instances start web-server --zone=us-central1-a
gcloud compute instances delete web-server --zone=us-central1-a

# ファイアウォールルール
gcloud compute firewall-rules create allow-http \
  --network=default --allow=tcp:80,tcp:443 \
  --target-tags=http-server --source-ranges=0.0.0.0/0

Cloud Storage

# バケット操作
gcloud storage buckets create gs://my-bucket --location=us-central1
gcloud storage ls gs://my-bucket/
gcloud storage cp file.txt gs://my-bucket/path/
gcloud storage rsync ./local-dir gs://my-bucket/remote/ --delete-unmatched-destination-objects

# ライフサイクルルールの設定
gcloud storage buckets update gs://my-bucket \
  --lifecycle-file=lifecycle.json

# 署名付き URL
gcloud storage sign-url gs://my-bucket/file.pdf --duration=1h

Cloud Functions

# Cloud Functions のデプロイ (第 2 世代)
gcloud functions deploy my-function \
  --gen2 \
  --runtime=python312 \
  --region=us-central1 \
  --source=. \
  --entry-point=handler \
  --trigger-http \
  --allow-unauthenticated \
  --memory=256MB \
  --timeout=60s \
  --set-env-vars="DB_HOST=10.0.0.5,ENV=production"

# 呼び出しとログの表示
gcloud functions call my-function --data='{"key":"value"}'
gcloud functions logs read my-function --region=us-central1 --limit=50

# 関数の一覧表示
gcloud functions list --format="table(name,status,runtime)"

IAM

# サービスアカウント
gcloud iam service-accounts create app-sa \
  --display-name="Application Service Account"

gcloud iam service-accounts keys create key.json \
  --iam-account=app-sa@my-project.iam.gserviceaccount.com

# ロールバインディング
gcloud projects add-iam-policy-binding my-project \
  --member="serviceAccount:app-sa@my-project.iam.gserviceaccount.com" \
  --role="roles/storage.objectViewer"

# IAM ポリシーの表示
gcloud projects get-iam-policy my-project \
  --format="table(bindings.role,bindings.members)"

# サービスアカウントの偽装
gcloud auth print-access-token --impersonate-service-account=app-sa@my-project.iam.gserviceaccount.com

GKE

# GKE クラスタの作成
gcloud container clusters create my-cluster \
  --num-nodes=3 \
  --machine-type=e2-standard-4 \
  --region=us-central1 \
  --enable-autoscaling --min-nodes=1 --max-nodes=10

# kubectl の認証情報を取得
gcloud container clusters get-credentials my-cluster --region=us-central1

# ノードプールのサイズ変更
gcloud container clusters resize my-cluster --num-nodes=5 --region=us-central1

便利なパターン

# スクリプト処理のための出力形式
gcloud compute instances list --format="value(name)" | while read name; do
  echo "Processing $name"
done

# 任意のリソースを JSON として記述
gcloud compute instances describe web-server --zone=us-central1-a --format=json

# 請求とコスト
gcloud billing accounts list
gcloud billing projects describe my-project

# Cloud SQL
gcloud sql instances create my-db --database-version=POSTGRES_15 \
  --tier=db-custom-2-8192 --region=us-central1
gcloud sql connect my-db --user=postgres

# Pub/Sub
gcloud pubsub topics create my-topic
gcloud pubsub subscriptions create my-sub --topic=my-topic
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Google Cloud CLI

The gcloud CLI manages GCP resources, configurations, and deployments from the terminal.

Setup

# Install gcloud CLI
curl https://sdk.cloud.google.com | bash
exec -l $SHELL

# Initialize and authenticate
gcloud init
gcloud auth login
gcloud auth application-default login

# Set project and region
gcloud config set project my-project-id
gcloud config set compute/region us-central1
gcloud config set compute/zone us-central1-a

# Named configurations for multiple projects
gcloud config configurations create production
gcloud config configurations activate production

Compute Engine

# Create a VM instance
gcloud compute instances create web-server \
  --machine-type=e2-medium \
  --image-family=ubuntu-2204-lts \
  --image-project=ubuntu-os-cloud \
  --boot-disk-size=30GB \
  --boot-disk-type=pd-ssd \
  --subnet=my-subnet \
  --tags=http-server,https-server \
  --service-account=app-sa@my-project.iam.gserviceaccount.com

# List instances
gcloud compute instances list \
  --filter="status=RUNNING AND labels.env=production" \
  --format="table(name,zone,machineType.basename(),networkInterfaces[0].accessConfigs[0].natIP)"

# SSH into instance
gcloud compute ssh web-server --zone=us-central1-a

# Stop/start/delete
gcloud compute instances stop web-server --zone=us-central1-a
gcloud compute instances start web-server --zone=us-central1-a
gcloud compute instances delete web-server --zone=us-central1-a

# Firewall rules
gcloud compute firewall-rules create allow-http \
  --network=default --allow=tcp:80,tcp:443 \
  --target-tags=http-server --source-ranges=0.0.0.0/0

Cloud Storage

# Bucket operations
gcloud storage buckets create gs://my-bucket --location=us-central1
gcloud storage ls gs://my-bucket/
gcloud storage cp file.txt gs://my-bucket/path/
gcloud storage rsync ./local-dir gs://my-bucket/remote/ --delete-unmatched-destination-objects

# Set lifecycle rules
gcloud storage buckets update gs://my-bucket \
  --lifecycle-file=lifecycle.json

# Signed URLs
gcloud storage sign-url gs://my-bucket/file.pdf --duration=1h

Cloud Functions

# Deploy a Cloud Function (2nd gen)
gcloud functions deploy my-function \
  --gen2 \
  --runtime=python312 \
  --region=us-central1 \
  --source=. \
  --entry-point=handler \
  --trigger-http \
  --allow-unauthenticated \
  --memory=256MB \
  --timeout=60s \
  --set-env-vars="DB_HOST=10.0.0.5,ENV=production"

# Invoke and view logs
gcloud functions call my-function --data='{"key":"value"}'
gcloud functions logs read my-function --region=us-central1 --limit=50

# List functions
gcloud functions list --format="table(name,status,runtime)"

IAM

# Service accounts
gcloud iam service-accounts create app-sa \
  --display-name="Application Service Account"

gcloud iam service-accounts keys create key.json \
  --iam-account=app-sa@my-project.iam.gserviceaccount.com

# Role bindings
gcloud projects add-iam-policy-binding my-project \
  --member="serviceAccount:app-sa@my-project.iam.gserviceaccount.com" \
  --role="roles/storage.objectViewer"

# View IAM policy
gcloud projects get-iam-policy my-project \
  --format="table(bindings.role,bindings.members)"

# Impersonate service account
gcloud auth print-access-token --impersonate-service-account=app-sa@my-project.iam.gserviceaccount.com

GKE

# Create GKE cluster
gcloud container clusters create my-cluster \
  --num-nodes=3 \
  --machine-type=e2-standard-4 \
  --region=us-central1 \
  --enable-autoscaling --min-nodes=1 --max-nodes=10

# Get credentials for kubectl
gcloud container clusters get-credentials my-cluster --region=us-central1

# Resize node pool
gcloud container clusters resize my-cluster --num-nodes=5 --region=us-central1

Useful Patterns

# Format output for scripting
gcloud compute instances list --format="value(name)" | while read name; do
  echo "Processing $name"
done

# Describe any resource as JSON
gcloud compute instances describe web-server --zone=us-central1-a --format=json

# Billing and cost
gcloud billing accounts list
gcloud billing projects describe my-project

# Cloud SQL
gcloud sql instances create my-db --database-version=POSTGRES_15 \
  --tier=db-custom-2-8192 --region=us-central1
gcloud sql connect my-db --user=postgres

# Pub/Sub
gcloud pubsub topics create my-topic
gcloud pubsub subscriptions create my-sub --topic=my-topic