$npx -y skills add Dicklesworthstone/agent_flywheel_clawdbot_skills_and_integrations --skill gcloudGoogle Cloud Platform CLI - manage GCP resources including Compute Engine, Cloud Run, GKE, Cloud Functions, Storage, BigQuery, and more.
| 1 | # GCloud Skill |
| 2 | |
| 3 | Use the `gcloud` CLI to manage Google Cloud Platform resources and services. |
| 4 | |
| 5 | ## Authentication |
| 6 | |
| 7 | Check current auth: |
| 8 | ```bash |
| 9 | gcloud auth list |
| 10 | ``` |
| 11 | |
| 12 | Login interactively: |
| 13 | ```bash |
| 14 | gcloud auth login |
| 15 | ``` |
| 16 | |
| 17 | Login with service account: |
| 18 | ```bash |
| 19 | gcloud auth activate-service-account --key-file=key.json |
| 20 | ``` |
| 21 | |
| 22 | Application default credentials: |
| 23 | ```bash |
| 24 | gcloud auth application-default login |
| 25 | ``` |
| 26 | |
| 27 | ## Project & Configuration |
| 28 | |
| 29 | List projects: |
| 30 | ```bash |
| 31 | gcloud projects list |
| 32 | ``` |
| 33 | |
| 34 | Set default project: |
| 35 | ```bash |
| 36 | gcloud config set project PROJECT_ID |
| 37 | ``` |
| 38 | |
| 39 | Show current config: |
| 40 | ```bash |
| 41 | gcloud config list |
| 42 | ``` |
| 43 | |
| 44 | Create named configuration: |
| 45 | ```bash |
| 46 | gcloud config configurations create my-config |
| 47 | gcloud config configurations activate my-config |
| 48 | ``` |
| 49 | |
| 50 | Set default region/zone: |
| 51 | ```bash |
| 52 | gcloud config set compute/region us-central1 |
| 53 | gcloud config set compute/zone us-central1-a |
| 54 | ``` |
| 55 | |
| 56 | ## Compute Engine (VMs) |
| 57 | |
| 58 | List instances: |
| 59 | ```bash |
| 60 | gcloud compute instances list |
| 61 | ``` |
| 62 | |
| 63 | Create instance: |
| 64 | ```bash |
| 65 | gcloud compute instances create my-vm \ |
| 66 | --zone=us-central1-a \ |
| 67 | --machine-type=e2-medium \ |
| 68 | --image-family=debian-12 \ |
| 69 | --image-project=debian-cloud |
| 70 | ``` |
| 71 | |
| 72 | SSH to instance: |
| 73 | ```bash |
| 74 | gcloud compute ssh my-vm --zone=us-central1-a |
| 75 | ``` |
| 76 | |
| 77 | Stop/start instance: |
| 78 | ```bash |
| 79 | gcloud compute instances stop my-vm --zone=us-central1-a |
| 80 | gcloud compute instances start my-vm --zone=us-central1-a |
| 81 | ``` |
| 82 | |
| 83 | Delete instance: |
| 84 | ```bash |
| 85 | gcloud compute instances delete my-vm --zone=us-central1-a |
| 86 | ``` |
| 87 | |
| 88 | ## Cloud Run |
| 89 | |
| 90 | List services: |
| 91 | ```bash |
| 92 | gcloud run services list |
| 93 | ``` |
| 94 | |
| 95 | Deploy from source: |
| 96 | ```bash |
| 97 | gcloud run deploy my-service --source . --region=us-central1 |
| 98 | ``` |
| 99 | |
| 100 | Deploy container: |
| 101 | ```bash |
| 102 | gcloud run deploy my-service \ |
| 103 | --image=gcr.io/PROJECT/IMAGE \ |
| 104 | --region=us-central1 \ |
| 105 | --allow-unauthenticated |
| 106 | ``` |
| 107 | |
| 108 | View logs: |
| 109 | ```bash |
| 110 | gcloud run services logs read my-service --region=us-central1 |
| 111 | ``` |
| 112 | |
| 113 | Update traffic split: |
| 114 | ```bash |
| 115 | gcloud run services update-traffic my-service \ |
| 116 | --to-revisions=LATEST=100 \ |
| 117 | --region=us-central1 |
| 118 | ``` |
| 119 | |
| 120 | ## Cloud Functions |
| 121 | |
| 122 | List functions: |
| 123 | ```bash |
| 124 | gcloud functions list |
| 125 | ``` |
| 126 | |
| 127 | Deploy function (2nd gen): |
| 128 | ```bash |
| 129 | gcloud functions deploy my-function \ |
| 130 | --gen2 \ |
| 131 | --runtime=nodejs20 \ |
| 132 | --region=us-central1 \ |
| 133 | --trigger-http \ |
| 134 | --entry-point=handler \ |
| 135 | --source=. |
| 136 | ``` |
| 137 | |
| 138 | View logs: |
| 139 | ```bash |
| 140 | gcloud functions logs read my-function --region=us-central1 |
| 141 | ``` |
| 142 | |
| 143 | Delete function: |
| 144 | ```bash |
| 145 | gcloud functions delete my-function --region=us-central1 |
| 146 | ``` |
| 147 | |
| 148 | ## Google Kubernetes Engine (GKE) |
| 149 | |
| 150 | List clusters: |
| 151 | ```bash |
| 152 | gcloud container clusters list |
| 153 | ``` |
| 154 | |
| 155 | Get credentials for kubectl: |
| 156 | ```bash |
| 157 | gcloud container clusters get-credentials my-cluster \ |
| 158 | --zone=us-central1-a |
| 159 | ``` |
| 160 | |
| 161 | Create cluster: |
| 162 | ```bash |
| 163 | gcloud container clusters create my-cluster \ |
| 164 | --zone=us-central1-a \ |
| 165 | --num-nodes=3 |
| 166 | ``` |
| 167 | |
| 168 | Resize node pool: |
| 169 | ```bash |
| 170 | gcloud container clusters resize my-cluster \ |
| 171 | --node-pool=default-pool \ |
| 172 | --num-nodes=5 \ |
| 173 | --zone=us-central1-a |
| 174 | ``` |
| 175 | |
| 176 | ## Cloud Storage |
| 177 | |
| 178 | List buckets: |
| 179 | ```bash |
| 180 | gcloud storage buckets list |
| 181 | ``` |
| 182 | |
| 183 | Create bucket: |
| 184 | ```bash |
| 185 | gcloud storage buckets create gs://my-bucket --location=us-central1 |
| 186 | ``` |
| 187 | |
| 188 | List objects: |
| 189 | ```bash |
| 190 | gcloud storage ls gs://my-bucket/ |
| 191 | ``` |
| 192 | |
| 193 | Copy files: |
| 194 | ```bash |
| 195 | # Upload |
| 196 | gcloud storage cp local-file.txt gs://my-bucket/ |
| 197 | |
| 198 | # Download |
| 199 | gcloud storage cp gs://my-bucket/file.txt ./ |
| 200 | |
| 201 | # Recursive |
| 202 | gcloud storage cp -r ./local-dir gs://my-bucket/ |
| 203 | ``` |
| 204 | |
| 205 | Sync directory: |
| 206 | ```bash |
| 207 | gcloud storage rsync -r ./local-dir gs://my-bucket/remote-dir |
| 208 | ``` |
| 209 | |
| 210 | ## Cloud SQL |
| 211 | |
| 212 | List instances: |
| 213 | ```bash |
| 214 | gcloud sql instances list |
| 215 | ``` |
| 216 | |
| 217 | Create instance: |
| 218 | ```bash |
| 219 | gcloud sql instances create my-instance \ |
| 220 | --database-version=POSTGRES_15 \ |
| 221 | --tier=db-f1-micro \ |
| 222 | --region=us-central1 |
| 223 | ``` |
| 224 | |
| 225 | Connect via proxy: |
| 226 | ```bash |
| 227 | gcloud sql connect my-instance --user=postgres |
| 228 | ``` |
| 229 | |
| 230 | Create database: |
| 231 | ```bash |
| 232 | gcloud sql databases create mydb --instance=my-instance |
| 233 | ``` |
| 234 | |
| 235 | ## BigQuery |
| 236 | |
| 237 | List datasets: |
| 238 | ```bash |
| 239 | bq ls |
| 240 | ``` |
| 241 | |
| 242 | Run query: |
| 243 | ```bash |
| 244 | bq query --use_legacy_sql=false 'SELECT * FROM dataset.table LIMIT 10' |
| 245 | ``` |
| 246 | |
| 247 | Create dataset: |
| 248 | ```bash |
| 249 | bq mk --dataset my_dataset |
| 250 | ``` |
| 251 | |
| 252 | Load data: |
| 253 | ```bash |
| 254 | bq load --source_format=CSV my_dataset.my_table gs://bucket/data.csv |
| 255 | ``` |
| 256 | |
| 257 | ## Pub/Sub |
| 258 | |
| 259 | List topics: |
| 260 | ```bash |
| 261 | gcloud pubsub topics list |
| 262 | ``` |
| 263 | |
| 264 | Create topic: |
| 265 | ```bash |
| 266 | gcloud pubsub topics create my-topic |
| 267 | ``` |
| 268 | |
| 269 | Publish message: |
| 270 | ```bash |
| 271 | gcloud pubsub topics publish my-topic --message="Hello" |
| 272 | ``` |
| 273 | |
| 274 | Create subscription: |
| 275 | ```bash |
| 276 | gcloud pubsub subscriptions create my-sub --topic=my-topic |
| 277 | ``` |
| 278 | |
| 279 | Pull messages: |
| 280 | ```bash |
| 281 | gcloud pubsub subscriptions pull my-sub --auto-ack |
| 282 | ``` |
| 283 | |
| 284 | ## Secret Manager |
| 285 | |
| 286 | List secrets: |
| 287 | ```bash |
| 288 | gcloud secrets list |
| 289 | ``` |
| 290 | |
| 291 | Create secret: |
| 292 | ```bash |
| 293 | echo -n "my-secret-value" | gcloud secrets create my-secret --data-file=- |
| 294 | ``` |
| 295 | |
| 296 | Access secret: |
| 297 | ```bash |
| 298 | gcloud secrets versions access latest --secret=my-secret |
| 299 | ``` |
| 300 | |
| 301 | Add new version: |
| 302 | ```bash |
| 303 | echo -n "new-value" | gcloud secrets versions add my-secret --data-file=- |
| 304 | ` |