gcp-billing-radar
Atomically re-link GCP projects to a new billing account in bulk — with dry-run by default, per-project verification, CSV results, and an auto-generated rollback plan.
Each re-link is a single atomic API call (projects.updateBillingInfo): the project moves from the old billing account to the new one with no unbilled gap and no downtime. Mid-cycle usage is split between the two accounts by Google automatically.
Install
pip install gcp-billing-radar
Auth
Uses Application Default Credentials:
gcloud auth application-default login
# or GOOGLE_APPLICATION_CREDENTIALS=/path/to/sa-key.json
Required permissions:
resourcemanager.projects.updateBillingInfoon each project (Project Owner / Billing Project Manager)billing.resourceAssociations.createon the target billing account (Billing Account User or Admin)
Usage
# 1. See what's on the old account
gcp-billing-radar list-projects -b OLD-ACCOUNT-ID --plain > projects.txt
# 2. Dry run (default — nothing is changed)
gcp-billing-radar swap -f projects.txt -b XXXXXX-XXXXXX-XXXXXX
# 3. Execute
gcp-billing-radar swap -f projects.txt -b XXXXXX-XXXXXX-XXXXXX --execute
# 4. Undo everything if needed
gcp-billing-radar rollback rollback-20260710-101500.csv
Projects can also be passed positionally or piped via stdin:
gcp-billing-radar list-projects -b OLD-ID --plain | \
gcp-billing-radar swap -b NEW-ID --execute
Behavior
- Dry-run by default — mutation requires an explicit
--execute. - Idempotent — projects already on the target account are skipped; safe to re-run.
- Per-project isolation — one failure (e.g. a 403) doesn't abort the batch.
- Verification — after each link the project's billing info is re-read and compared.
- Rollback plan — every successful swap is recorded with its original account in
rollback-<ts>.csv, consumable by therollbacksubcommand. - Results CSV — full audit trail (
results-<ts>.csv) for every run, including dry runs. - Exit code is non-zero if any project failed — CI/pipeline friendly.
Output files
Every run writes two CSV files to the working directory:
results-<ts>.csv — full audit trail of every project in the run:
project_id,old_account,new_account,status,detail
project1,OLD111-AAAAAA-BBBBBB,XXXXXX-XXXXXX-XXXXXX,success,
project2,OLD111-AAAAAA-BBBBBB,XXXXXX-XXXXXX-XXXXXX,success,
already-done,XXXXXX-XXXXXX-XXXXXX,XXXXXX-XXXXXX-XXXXXX,skip-already-linked,
rollback-<ts>.csv — the undo plan, mapping each moved project back to its original account:
project_id,restore_to_account
project1,OLD111-AAAAAA-BBBBBB
project2,OLD111-AAAAAA-BBBBBB
Feed the rollback file straight back in to revert: gcp-billing-radar rollback rollback-<ts>.csv.
Python API
from gcp_billing_radar import BillingSwapper
s = BillingSwapper()
report = s.swap_batch(["proj-a", "proj-b"], "XXXXXX-XXXXXX-XXXXXX", execute=True)
print(len(report.success), "moved")
report.write_rollback()
License
MIT
Metadata
Release files for gcp-billing-radar 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gcp_billing_radar-0.1.1.tar.gz | 6.6 kB | Without provenance | Details for gcp_billing_radar-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gcp_billing_radar-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for gcp_billing_radar-0.1.1-py3-none-any.whl |
Total release size: 15.0 kB
Release files / gcp_billing_radar-0.1.1.tar.gz
| Download URL | gcp_billing_radar-0.1.1.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
03af140d6e5391c9f509ff460a7e267e54a1e4afa2b114330dd26b2ea1b63579
|
|
BLAKE2b-256 checksum How to use checksums |
653404dabda73e135b5beead8fe58e127390e7b1e8ba099dddfaf5c23ca7a8ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / gcp_billing_radar-0.1.1-py3-none-any.whl
| Download URL | gcp_billing_radar-0.1.1-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
823ba0144da0a4408b90d9ca95a46fc8acdc484143c10f2cf4fa2b97364dd20b
|
|
BLAKE2b-256 checksum How to use checksums |
3cead3bed9e7d619f5ed839ffeec001ce0eb18bc0128279cf01db2d082ad8613
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for gcp-billing-radar 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.