gcp-operations

Manage GCP Compute Engine VM networking, firewall rules, ephemeral IPs, and memory hardening.

Updated Jul 3, 2026
One-click install
npx skills add https://github.com/CHENHUI-X/toolbox --skill gcp-operations-chenhui-x
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gcp-operations
Source: https://github.com/CHENHUI-X/toolbox/tree/main/custom-skills/devops/gcp-operations
Command: npx skills add https://github.com/CHENHUI-X/toolbox --skill gcp-operations-chenhui-x

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Running services on a GCP Compute Engine VM involves two independent firewall layers, ephemeral public IPs that change on reboot, and OOM risks on small instances. This Skill provides the operational knowledge and scripts to diagnose connectivity, detect IP changes, and keep services alive. ## Core Features & Use Cases - Network & Firewall Diagnostics: Distinguish GCP Cloud Firewall rules from VM-level ufw rules, inspect network tags and service account scopes via the metadata server, and add firewall rules with gcloud. - Ephemeral IP Detection & Auto-Update: A boot-time systemd oneshot script detects public IP changes, updates Cloudflare DDNS, regenerates proxy subscription files, restarts services, and sends Telegram notifications. - Memory & OOM Hardening: Configure swap, swappiness, systemd MemoryMax limits, and OOM score adjustments to protect small instances from out-of-memory kills. - Use Case: After rebooting a 1GB GCP VM hosting a sing-box proxy, the boot script detects the new ephemeral IP, updates the DNS A record and subscription configs, and notifies you on Telegram without manual intervention. ## Quick Start Use the gcp-operations skill to check why a port listening on my GCP VM is unreachable from the internet and fix the firewall configuration.

Frequently Asked Questions about gcp-operations

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I check why a port is unreachable on my GCP VM?

GCP traffic passes two independent firewall layers: GCP Cloud Firewall rules and the VM's own ufw/iptables. Check the instance's network tags via the metadata server, verify matching firewall rules with gcloud, and confirm the port is open in ufw on the host.

How to detect GCP ephemeral IP changes automatically?

Use a systemd oneshot service triggered at boot that fetches the current external IP from the GCP metadata server, compares it against a stored value, and on change updates DDNS records, regenerates config files, and sends a Telegram notification.

Does GCP support testing open ports from inside the same VM?

No, GCP does not support hairpinning, so connecting to the VM's own external IP from inside fails. Use an external port checker service, run nmap from a different source, or test via an external API.

How do I prevent OOM kills on a 1GB GCP instance?

Create a swap file and persist it in /etc/fstab, lower vm.swappiness to around 30, and set systemd MemoryMax and MemoryHigh limits on critical services. Adjust oom_score_adj to protect essential processes from being killed first.

What scopes does the default GCP compute service account have?

The default compute service account typically has devstorage.read_only, logging.write, and monitoring.write scopes, but no compute scope. This means it cannot manage firewall rules or instances without additional scopes or external gcloud credentials.