Catalog npm
PACKAGE EXPLORERView in registry

8bitsapps-gcp-utils

npm

GCP Utility CLI for firewall and storage operations

clifirewallgcpgoogle-cloudutility
Versions collected12
Direct dependencies10From release 3.0.0
Last observed20 Oct, 21:21 UTC

README

Current package documentation

GCP Utils

Interactive CLI tool for managing Google Cloud Platform (GCP) services, including firewall and storage operations.

Features

Update Firewall with current IP

Automatically updates a GCP firewall rule with your current public IP address. Useful for development environments with dynamic IPs that need access to firewall-protected resources.

  • Automatically detects current public IP.
  • Preserves configured fixed IP addresses.
  • Adds current IP to the firewall rule's sourceRanges.

Browse and manage GCS storage

Interactive navigator for Google Cloud Storage:

  • Browse buckets and folders.
  • Filter any listing incrementally by typing; Load more reveals further items.
  • View files with size information.
  • Download files to current directory.
  • Upload local files to GCS.
  • Create folders in GCS.
  • Delete files from GCS.
  • Delete folders from GCS (recursive).
  • Support for multiple buckets per configuration.

Manage authentication

Logs in with short-lived Application Default Credentials (ADC), one identity per configuration, so that several GCP accounts from different organizations can be used side by side without static service account keys.

Initialize configuration

Sets up the global configuration directory (~/.8bitsapps-gcp-utils/) with the required structure.

Requirements

  • Node.js: >= 18.0.0 (Node.js 22 LTS recommended)
  • Google Cloud SDK: gcloud in PATH, used for the login flow.

Installation

npm install -g 8bitsapps-gcp-utils

After installation, the gcpUtils command will be available globally.

Install from source

git clone https://github.com/giuseppelanzi-8bitsapps-gcp-utils.git
cd 8bitsapps-gcp-utils
npm install
npm link

The npm link command makes gcpUtils available globally. To remove:

npm unlink

Configuration

First run

On first run, the tool will prompt you to initialize:

gcpUtils

This creates the following structure:

~/.8bitsapps-gcp-utils/
├── configurations/
├── credentials/     (legacy service account keys)
└── gcloud/          (one directory per identity)

Configuration file

Create a JSON file in ~/.8bitsapps-gcp-utils/configurations/ (e.g., gcp-options-myproject.json):

{
  "auth": {
    "identity": "acme",
    "account": "me@acme.com",
    "impersonateServiceAccount": "gcp-utils@acme-prod.iam.gserviceaccount.com",
    "quotaProject": "acme-prod"
  },
  "defaultProjectId": "my-gcp-project-id",
  "defaultFirewallRule": "allow-my-ip",
  "defaultFixedIPAddresses": ["203.0.113.10/32"],
  "buckets": [
    { "name": "my-bucket-prod", "displayName": "Production" },
    { "name": "my-bucket-dev", "displayName": "Development" }
  ],
  "defaultBucket": "my-bucket-dev"
}
FieldDescription
auth.identityName of the credentials set. Each identity gets its own gcloud/<identity>/ directory.
auth.accountGoogle account to log in with (optional, pre-selects it in the browser).
auth.impersonateServiceAccountService account to impersonate (optional). Belongs to the identity, see below.
auth.quotaProjectProject billed for API usage. Per configuration. Only needed when not impersonating.
credentialsFileDeprecated. Service account key filename in credentials/.
defaultProjectIdGCP project ID.
defaultFirewallRuleFirewall rule name to update.
defaultFixedIPAddressesArray of fixed IPs to always keep in the rule.
bucketsArray of available buckets (optional).
defaultBucketDefault bucket for storage operations.

Settings file

List behavior is tuned through an optional settings.json, read from the current working directory first, then from ~/.8bitsapps-gcp-utils/. Missing keys fall back to the defaults below:

{
  "storage": { "maxItems": 30, "pageStep": 30 },
  "janitor": { "maxItems": 50, "pageStep": 50, "stoppedVmThresholdDays": 30 }
}
KeyDescription
maxItemsInitial window of a list: how many items are shown before the Load more row. It is not a hard cap — every item stays reachable through Load more or by typing a filter.
pageStepHow many further items each Load more reveals.
janitor.stoppedVmThresholdDaysDays a VM must have been stopped to be reported as a zombie.

GCP Credentials

Run gcpUtils, choose Manage authentication, pick the configuration, then Login. A browser opens and the resulting credentials are written to gcloud/<identity>/application_default_credentials.json.

Credentials are per identity, so several accounts stay authenticated at the same time and the tool never touches your everyday ~/.config/gcloud. The stored refresh token yields access tokens valid for one hour; nothing needs to be rotated by hand.

One login per identity

An identity is a set of credentials, not a project: it is the Google account you authenticate as, plus the service account it impersonates, if any. Configurations that share both can share an identity and one login, each keeping its own defaultProjectId and quotaProject.

Impersonation is written into the credentials file at login time, so it belongs to the identity: two configurations sharing an identity must agree on impersonateServiceAccount. If they disagree, the last login wins and the tool warns you before running any command. Give one of them its own identity instead.

The quota project works the other way around: it is per configuration. The credentials file may carry a quota_project_id of its own — whichever configuration happened to be current at login time — so the tool overrides it in memory with auth.quotaProject before handing the credentials to the client library. The file on disk is never modified, and configurations sharing an identity can bill their API calls to different projects.

Required roles:

  • Firewall: Compute Security Admin or Compute Network Admin
  • Storage: Storage Object Admin
  • Compute Engine (janitor): Compute Viewer

Set auth.impersonateServiceAccount to act with the roles of a service account instead of your own. No key material is stored: the tool holds your user credentials and Google mints a one-hour token for the service account, which the audit log attributes to you.

It requires roles/iam.serviceAccountTokenCreator on that service account for your user, and the roles above granted to the service account rather than to you.

Migrating away from service account keys

Configurations with credentialsFile keep working and print a deprecation warning. To migrate, replace credentialsFile with an auth block, log in, verify with Status, and then delete the key from the GCP console — removing the local file alone does not invalidate it.

Usage

gcpUtils

Navigate menus with arrow keys. Press ESC to go back or exit. In filterable lists (storage browser, janitor), type to narrow the list as you go: ESC first clears an active filter, then exits; the left arrow goes back one level when the filter is empty.

License

ISC

Author

8BitsApps - https://8bitsapps.com

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 12

Collected releases
VersionPublishedDirect dependenciesOpen version
3.0.0Registry latest11 Jul 202610
2.0.07 Apr 20269
1.1.010 Feb 20268
1.0.86 Feb 20268
1.0.75 Feb 20268
1.0.65 Feb 20268
1.0.55 Feb 20268
1.0.426 Jan 20268
1.0.326 Jan 20268
1.0.226 Jan 20268
1.0.125 Jan 20268
1.0.025 Jan 20268

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
giuseppelanzi/8bitsapps-gcp-utils

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 21:21 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:fd23139a08d8e9ffa2601bce58bbf8a4f17ec394077e7a64c574818d34ebd8fa