cloud-resources
npx skills add https://github.com/serendipityoneinc/srp-claude-code-marketplace --skill cloud-resources
Agent 安装分布
Skill 文档
Cloud Resources Management (äºèµæºç®¡ç)
为è¿ç»´äººåæä¾ GCP äºèµæºç管çåçæ§åè½ï¼å æ¬æ¥çå管ç Compute EngineãCloud Storageãç½ç»èµæºçã
Provides GCP cloud resource management and monitoring for DevOps engineers, including Compute Engine, Cloud Storage, networking, and more.
Quick Start
List Compute Instances (ååºè®¡ç®å®ä¾)
æ¾ç¤ºææ GCE å®ä¾
List all Compute Engine instances
Check Cloud Storage (æ£æ¥äºåå¨)
ååºææ GCS buckets
List all Cloud Storage buckets
View Project Resources (æ¥ç项ç®èµæº)
æ¾ç¤ºé¡¹ç® srpproduct-dc37e çèµæºæ¦åµ
Show resource overview for project srpproduct-dc37e
Key Features
1. Compute Engine Management (计ç®å¼æç®¡ç)
View and monitor GCE instances:
Common Operations:
# List instances
gcloud compute instances list
# Get instance details
gcloud compute instances describe <instance-name>
# Check instance status
gcloud compute instances get-serial-port-output <instance-name>
2. Cloud Storage (äºåå¨)
Monitor and manage GCS buckets and objects:
Common Operations:
# List buckets
gcloud storage buckets list
# List objects in bucket
gcloud storage ls gs://<bucket-name>/
# Get object metadata
gcloud storage objects describe gs://<bucket-name>/<object-name>
3. Network Resources (ç½ç»èµæº)
View network configuration and health:
Common Operations:
# List networks
gcloud compute networks list
# List firewalls
gcloud compute firewall-rules list
# List load balancers
gcloud compute forwarding-rules list
4. Resource Monitoring (èµæºçæ§)
Monitor resource usage and costs:
Common Operations:
# Project info
gcloud projects describe <project-id>
# List services
gcloud services list --enabled
# Check quotas
gcloud compute project-info describe --project=<project-id>
Common Workflows
Workflow 1: Instance Health Check
1. User: "æ£æ¥ææ production å®ä¾çå¥åº·ç¶æ"
2. List instances: gcloud compute instances list --filter="labels.env=production"
3. Check each instance status
4. Review recent logs if needed
5. Report health summary
Workflow 2: Storage Audit
1. User: "审计 GCS buckets çè®¿é®æé"
2. List all buckets
3. Get IAM policy for each bucket
4. Check public access
5. Identify potential security issues
6. Generate audit report
Workflow 3: Network Troubleshooting
1. User: "为ä»ä¹æå¡ A æ æ³è¿æ¥å°æå¡ Bï¼"
2. Check firewall rules
3. Verify network connectivity
4. Review load balancer config
5. Check DNS settings
6. Diagnose issue and suggest fixes
Examples (示ä¾)
Example 1: List Compute Instances (ååºè®¡ç®å®ä¾)
User (Chinese):
æ¾ç¤ºé¡¹ç®ä¸æææ£å¨è¿è¡ç GCE å®ä¾
Assistant Response:
æä¼ååºæææ£å¨è¿è¡ç GCE å®ä¾ã
<executes: gcloud compute instances list --filter="status=RUNNING">
**Running Compute Engine Instances:**
| Name | Zone | Machine Type | Internal IP | External IP | Status |
|------|------|--------------|-------------|-------------|--------|
| api-server-prod-1 | us-east1-b | n2-standard-4 | 10.0.1.10 | 34.xxx.xxx.1 | RUNNING |
| api-server-prod-2 | us-east1-c | n2-standard-4 | 10.0.1.11 | 34.xxx.xxx.2 | RUNNING |
| worker-prod-1 | us-east1-b | n2-standard-8 | 10.0.2.10 | - | RUNNING |
| db-primary | us-east1-b | n2-highmem-8 | 10.0.3.10 | - | RUNNING |
**Summary:**
- Total running instances: 4
- Machine types: n2-standard-4 (2), n2-standard-8 (1), n2-highmem-8 (1)
- 2 instances with external IPs
- All instances in us-east1 region
Example 2: Storage Bucket Overview (å卿¡¶æ¦è§)
User (English):
List all Cloud Storage buckets and their sizes
Assistant Response:
I'll list all GCS buckets with size information.
<executes: gcloud storage buckets list>
<executes: gcloud storage du -s gs://<bucket>/* for each bucket>
**Cloud Storage Buckets:**
| Bucket Name | Location | Storage Class | Size | Objects |
|-------------|----------|---------------|------|---------|
| srp-prod-data | us-east1 | STANDARD | 2.3 TB | 450,230 |
| srp-prod-logs | us-east1 | NEARLINE | 890 GB | 1,250,000 |
| srp-prod-backups | us-east1 | COLDLINE | 5.1 TB | 125 |
| srp-dev-data | us-east1 | STANDARD | 120 GB | 15,430 |
**Summary:**
- Total storage: 8.4 TB
- Monthly estimated cost: ~$180 (based on storage class)
- Largest bucket: srp-prod-backups (5.1 TB)
- Most objects: srp-prod-logs (1.25M objects)
**Recommendations:**
- Consider lifecycle policies for old logs
- Review backup retention policy
- Monitor storage costs
Example 3: Network Firewall Audit (ç½ç»é²ç«å¢å®¡è®¡)
User (Chinese):
æ£æ¥æ¯å¦æè¿äºå®½æ¾çé²ç«å¢è§å
Assistant Response:
æä¼æ£æ¥é²ç«å¢è§åï¼è¯å«æ½å¨çå®å
¨é£é©ã
<executes: gcloud compute firewall-rules list>
**Firewall Rules Audit:**
**â
Secure Rules (10):**
- allow-internal-prod: 10.0.0.0/8 â All (Internal only)
- allow-ssh-bastion: Specific IPs â tcp:22
- allow-https-lb: Load balancer â tcp:443
- ... (7 more)
**â ï¸ Potentially Risky Rules (2):**
1. **allow-all-dev** â ï¸
- Source: 0.0.0.0/0 (All internet)
- Ports: tcp:8080, tcp:3000
- Target: dev-instances
- **Risk**: Development ports exposed to internet
- **Recommendation**: Restrict to office IPs or VPN
2. **allow-ssh-temp** â ï¸ HIGH PRIORITY
- Source: 0.0.0.0/0 (All internet)
- Port: tcp:22
- Target: All instances
- **Risk**: SSH open to entire internet
- **Recommendation**: DELETE immediately and use bastion host
**Summary:**
- Total rules: 12
- Secure: 10
- Needs review: 2
**Action Items:**
1. ð´ URGENT: Review and restrict allow-ssh-temp rule
2. ð¡ Review allow-all-dev and limit to VPN/office IPs
3. ð¢ Document all firewall rule purposes
Important Notes
Access Control (è®¿é®æ§å¶)
- Requires GCP authentication (gcloud)
- Operations limited by IAM permissions
- Read access to most resources
- Some management operations available with proper roles
Safety Guidelines (å®å ¨æå)
- Caution with management operations: Always verify before executing
- Prefer read-only commands for investigation
- Use appropriate environments (dev/staging/prod)
- Follow change management processes
- Document all changes
Best Practices (æä½³å®è·µ)
- Use labels for resource organization
- Enable audit logging
- Regular security reviews
- Monitor costs and quotas
- Use least privilege access
Prerequisites
GCP CLI (gcloud)
Ensure gcloud is installed and configured:
# Check gcloud installation
gcloud version
# Authenticate
gcloud auth login
# Set default project
gcloud config set project srpproduct-dc37e
# Verify access
gcloud projects describe srpproduct-dc37e
Environment Variables
export GCP_PROJECT_ID="srpproduct-dc37e"
export GCP_REGION="us-east1"
export GCP_ZONE="us-east1-b"
Required IAM Roles
Minimum roles needed:
roles/compute.viewer– View compute resourcesroles/storage.objectViewer– View storage objectsroles/viewer– Basic project viewing
For management operations:
roles/compute.instanceAdmin– Manage instancesroles/storage.admin– Manage storageroles/iam.securityReviewer– Security audits
Limitations
Current Limitations
- Uses gcloud CLI (not direct API integration)
- No real-time dashboards
- Limited cost analytics
- No automated remediation
- Manual execution of commands
Future Enhancements
- Direct GCP API integration via MCP
- Real-time resource monitoring
- Cost analytics and optimization
- Automated compliance checks
- Integration with Terraform/IaC
- Alert and notification system
Troubleshooting
Issue 1: “gcloud: command not found”
Solutions:
- Install gcloud SDK: https://cloud.google.com/sdk/docs/install
- Add to PATH
- Restart terminal
Issue 2: “Permission denied”
Solutions:
- Check current account:
gcloud auth list - Verify IAM permissions
- Switch account if needed:
gcloud config set account <email> - Contact GCP admin
Issue 3: “Project not found”
Solutions:
- List available projects:
gcloud projects list - Set correct project:
gcloud config set project <project-id> - Verify project ID spelling
Security & Compliance
Resource Access Audit
- All operations are logged in Cloud Audit Logs
- Review logs regularly
- Follow principle of least privilege
- Use service accounts for automation
Sensitive Data
- Do not expose credentials
- Use Secret Manager for secrets
- Enable data encryption
- Regular access reviews
Compliance
- Follow company security policies
- Document all infrastructure changes
- Regular compliance audits
- Incident response procedures
Related Skills
k8s-management: Kubernetes cluster management- Future:
monitoring-alerts,cost-optimization,incident-response
Operations Reference
Safe Read Operations (å®å ¨çåªè¯»æä½)
â List resources â Describe resources â Get logs â Check status â View metrics
Management Operations (éè°¨æ æ§è¡)
â ï¸ Start/stop instances â ï¸ Modify configurations â ï¸ Create/delete resources â ï¸ Change IAM policies â ï¸ Network changes
Always verify management operations before executing and follow change management processes.