Skip to main content

astroctl cloud gcp connect

Link your GCP project to AstroPulse

Synopsis​

Grant AstroPulse access to your GCP project to create and manage GKE clusters.

Generates a setup script and opens Google Cloud Shell in your browser. Run the script there. It creates the required IAM service account and permissions. Cloud Shell uses your browser's default Google account. Pass --account with the email of the Google account that owns the project to open Cloud Shell as that account; it must be signed in to the browser, and the setup script stops if Cloud Shell runs as another. A setup script runs only within 24 hours of being made; after that, run connect again for a fresh one. If you later remove AstroPulse's access in your cloud, don't re-run an old setup script: it would grant it again.

When you install Vulnerability Scanning on a cluster, AstroPulse also grants the scanner's Kubernetes service account read access to Artifact Registry in the project, so private images can be scanned. Every cluster in the project shares that grant, so removing the add-on leaves it in place and tells you how to remove it.

Use --local to save the script and run it yourself with a local gcloud install.

If --project-number is not provided, astroctl looks it up with local gcloud. When provided, astroctl verifies it locally when possible; the setup script always checks it matches --project-id before making any changes. Find your project number: GCP Console > IAM & Admin > Settings > Project number Or run: gcloud projects describe PROJECT_ID --format='value(projectNumber)'

Find your project ID: GCP Console > IAM & Admin > Settings

Terminal
astroctl cloud gcp connect [flags]

Examples​

Terminal
# Connect GCP project (opens Cloud Shell in browser)
astroctl cloud gcp connect --project-id my-project --region us-central1 --cluster-name prod

# Open Cloud Shell as the Google account that owns the project
astroctl cloud gcp connect --project-id my-project --region us-central1 --cluster-name prod --account owner@example.com

# Connect with an explicit project number
astroctl cloud gcp connect --project-id my-project --project-number 123456789012 --region us-central1 --cluster-name prod

# Save the setup script locally and run it in another terminal with gcloud access
astroctl cloud gcp connect --project-id my-project --region us-central1 --cluster-name prod --local

# Save script under a custom filename
astroctl cloud gcp connect --project-id my-project --region us-central1 --cluster-name prod --output setup.sh

Options​

Terminal
--account string Email of the Google account that owns the project; Cloud Shell opens as it when it is signed in to the browser
--cluster-name string Cluster name for this connection (required)
--duration string Credential duration (e.g., 30m, 1h) (default "1h")
--force-update Force reconfiguration even if already set up
-h, --help help for connect
--local Save setup script for local gcloud access and wait while you run it in another terminal
-o, --output string Custom filename for the setup script (default: astro-gcp-setup-<cluster-name>.sh)
--project-id string GCP project ID (required)
--project-number string GCP project number (optional; looked up with local gcloud if omitted)
--region string GCP region (e.g., us-central1) (required)

SEE ALSO​