
Using Cloud Cli
- 97 installs
- 6 repo stars
- Updated July 22, 2026
- julianobarbosa/claude-code-skills
Cloud CLI patterns for GCP and AWS. Use when running bq queries, gcloud commands, aws commands, making cloud service decisions.
About
Cloud CLI patterns for GCP and AWS.. Use for bq queries, gcloud commands, aws commands, cloud service decisions.
- intermediate skill
- core: cloud & infrastructure
Using Cloud Cli by the numbers
- 97 all-time installs (skills.sh)
- +1 installs in the week ending Aug 2, 2026 (Skillselion tracking)
- Ranked #565 of 1,039 Cloud & Infrastructure skills by installs in the Skillselion catalog
- Data as of Aug 3, 2026 (Skillselion catalog sync)
npx skills add https://github.com/julianobarbosa/claude-code-skills --skill using-cloud-cliAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 97 |
|---|---|
| repo stars | ★ 6 |
| Last updated | July 22, 2026 |
| Repository | julianobarbosa/claude-code-skills ↗ |
What it does
Cloud CLI patterns for GCP and AWS. Use when running bq queries, gcloud commands, aws commands, making cloud service decisions.
Files
Cloud CLI Patterns
Credentials are pre-configured. Use --help or Context7 for syntax.
BigQuery
# Always estimate cost first
bq query --dry_run --use_legacy_sql=false 'SELECT ...'
# Run query
bq query --use_legacy_sql=false --format=json 'SELECT ...'
# List tables
bq ls project:dataset
# Get table schema
bq show --schema --format=json project:dataset.tableCost awareness: Charged per bytes scanned. Use --dry_run, partition tables, specify columns.
GCP (gcloud)
# List resources
gcloud compute instances list --format=json
# Describe resource
gcloud compute instances describe INSTANCE --zone=ZONE --format=json
# Create with explicit project
gcloud compute instances create NAME --project=PROJECT --zone=ZONE
# Use --quiet for automation
gcloud compute instances delete NAME --quietAWS
# List resources
aws ec2 describe-instances --output json
# With JMESPath filtering
aws ec2 describe-instances --query 'Reservations[].Instances[].InstanceId' --output text
# Explicit region
aws s3 ls s3://bucket --region us-west-2
# Dry run where available
aws ec2 run-instances --dry-run ...References
- GCP.md - GCP service patterns and common commands
- AWS.md - AWS service patterns and common commands
- scripts/ - Helper scripts for common operations
---
Gotchas
- `gcloud auth login` and `gcloud auth application-default login` are DIFFERENT credentials — a script working for the user can 401 in CI because CI only has the latter.
- AWS CLI v1 vs v2 have different config formats — both may be installed;
aws --versionreveals which is the defaultawsbinary. - BigQuery cost estimation requires `--dry_run` — without it, you can run a $100 query thinking it's free. Always estimate first.
- Precedence:
AWS_PROFILEvs--profileflag vsAWS_ACCESS_KEY_IDdirect env — three-way precedence is order-dependent and rarely documented. - gcloud impersonation chains via `--impersonate-service-account` need IAM token-creator on EACH hop — missing one hop returns 403 with vague "permission denied".
- `aws sts get-caller-identity` is the cheapest way to verify which credential you're actually using — always check first.
AWS Patterns
S3
# List buckets
aws s3 ls
# List objects
aws s3 ls s3://bucket/prefix/
# Copy
aws s3 cp local_file s3://bucket/path/
aws s3 cp s3://bucket/path/file .
# Sync
aws s3 sync local_dir/ s3://bucket/path/
aws s3 sync s3://bucket/path/ local_dir/
# Remove
aws s3 rm s3://bucket/path/file
aws s3 rm s3://bucket/path/ --recursiveEC2
# List instances
aws ec2 describe-instances \
--query 'Reservations[].Instances[].[InstanceId,State.Name,PublicIpAddress]' \
--output table
# Start/Stop
aws ec2 start-instances --instance-ids i-xxxxx
aws ec2 stop-instances --instance-ids i-xxxxx
# Create instance
aws ec2 run-instances \
--image-id ami-xxxxx \
--instance-type t3.micro \
--key-name my-key \
--security-group-ids sg-xxxxx \
--subnet-id subnet-xxxxx
# Dry run
aws ec2 run-instances --dry-run ...Lambda
# List functions
aws lambda list-functions --query 'Functions[].FunctionName' --output table
# Invoke
aws lambda invoke --function-name FUNC output.json
cat output.json
# Update code
aws lambda update-function-code \
--function-name FUNC \
--zip-file fileb://function.zip
# View logs
aws logs filter-log-events \
--log-group-name /aws/lambda/FUNC \
--start-time $(date -d '1 hour ago' +%s000)ECS
# List clusters
aws ecs list-clusters
# List services
aws ecs list-services --cluster CLUSTER
# Update service (force deploy)
aws ecs update-service \
--cluster CLUSTER \
--service SERVICE \
--force-new-deployment
# View tasks
aws ecs list-tasks --cluster CLUSTER --service-name SERVICEIAM
# List roles
aws iam list-roles --query 'Roles[].RoleName' --output table
# Get user
aws sts get-caller-identity
# List attached policies
aws iam list-attached-role-policies --role-name ROLECommon Flags
| Flag | Purpose |
|---|---|
--region REGION | Explicit region |
| `--output json\ | table\ |
--query 'JMESPath' | Filter results |
--profile PROFILE | Named profile |
--dry-run | Preview (EC2, etc.) |
JMESPath Examples
# Get instance IDs
--query 'Reservations[].Instances[].InstanceId'
# Filter by tag
--query 'Reservations[].Instances[?Tags[?Key==`Name` && Value==`web`]]'
# Multiple fields
--query 'Reservations[].Instances[].[InstanceId,State.Name]'
# First result
--query 'Reservations[0].Instances[0].InstanceId'GCP Patterns
BigQuery
# Cost estimation
bq query --dry_run --use_legacy_sql=false \
'SELECT * FROM `project.dataset.table` WHERE date > "2024-01-01"'
# Standard query
bq query --use_legacy_sql=false --format=json \
'SELECT col1, col2 FROM `project.dataset.table` LIMIT 100'
# Save to table
bq query --use_legacy_sql=false \
--destination_table=project:dataset.result \
'SELECT ...'
# Export to GCS
bq extract --destination_format=NEWLINE_DELIMITED_JSON \
project:dataset.table gs://bucket/path/*.jsonCost Optimization
- Always
--dry_runfirst to estimate bytes scanned - Avoid
SELECT *- specify columns - Use partitioned tables with partition filters
- Use clustered tables for frequent filter columns
LIMITdoesn't reduce scan cost (use in WHERE)
Cloud Storage
# List
gsutil ls gs://bucket/path/
# Copy
gsutil cp local_file gs://bucket/path/
gsutil cp -r local_dir/ gs://bucket/path/
# Sync (like rsync)
gsutil rsync -r local_dir/ gs://bucket/path/
# Download
gsutil cp gs://bucket/path/file .
gsutil cp -r gs://bucket/path/ local_dir/Compute Engine
# List instances
gcloud compute instances list --format="table(name,zone,status,networkInterfaces[0].accessConfigs[0].natIP)"
# Create
gcloud compute instances create NAME \
--zone=us-central1-a \
--machine-type=e2-medium \
--image-family=debian-12 \
--image-project=debian-cloud
# SSH
gcloud compute ssh INSTANCE --zone=ZONE
# Stop/Start
gcloud compute instances stop INSTANCE --zone=ZONE
gcloud compute instances start INSTANCE --zone=ZONECloud Run
# Deploy
gcloud run deploy SERVICE \
--image=gcr.io/PROJECT/IMAGE \
--region=us-central1 \
--allow-unauthenticated
# List services
gcloud run services list --format=json
# View logs
gcloud run services logs read SERVICE --region=REGIONIAM
# List service accounts
gcloud iam service-accounts list --format=json
# Create service account
gcloud iam service-accounts create NAME --display-name="Description"
# Add role binding
gcloud projects add-iam-policy-binding PROJECT \
--member="serviceAccount:SA@PROJECT.iam.gserviceaccount.com" \
--role="roles/storage.objectViewer"Common Flags
| Flag | Purpose |
|---|---|
--project=PROJECT | Explicit project |
--format=json | JSON output for parsing |
--quiet | No prompts (automation) |
--filter="name:pattern" | Server-side filter |
#!/bin/bash
# Estimate BigQuery query cost before running
# Usage: bq-cost-check.sh "SELECT * FROM table"
set -euo pipefail
QUERY="$1"
PRICE_PER_TB=5.00
result=$(bq query --dry_run --use_legacy_sql=false --format=json "$QUERY" 2>&1)
bytes=$(echo "$result" | grep -oP 'totalBytesProcessed.*?(\d+)' | grep -oP '\d+' | head -1)
if [ -z "$bytes" ]; then
echo "Error: Could not estimate query cost"
echo "$result"
exit 1
fi
gb=$(echo "scale=2; $bytes / 1024 / 1024 / 1024" | bc)
tb=$(echo "scale=6; $bytes / 1024 / 1024 / 1024 / 1024" | bc)
cost=$(echo "scale=4; $tb * $PRICE_PER_TB" | bc)
echo "Query will scan: ${gb} GB"
echo "Estimated cost: \$${cost}"
if (($(echo "$cost > 1.00" | bc -l))); then
echo "WARNING: Query cost exceeds $1.00"
read -p "Continue? (y/N) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 1
fi
fi