Prerequisites
- A GCP account with a project
- A service account with Compute Engine permissions
- A service account key file (JSON)
- An SSH key pair (local
~/.ssh/id_rsaand~/.ssh/id_rsa.pub)
Required IAM Permissions
The service account needs these roles (or use theCompute Admin role):
roles/compute.admin) role to your service account.
Create a Service Account and Key
- Go to IAM & Admin > Service Accounts > Create Service Account
- Name it
osmedeus-cloud(or similar) - Grant it the Compute Admin role
- Go to the service account > Keys > Add Key > Create new key > JSON
- Save the JSON file (e.g.,
~/.gcp/osmedeus-sa.json)
gcloud CLI:
Configuration
Minimal Setup
Machine Types
| Machine Type | vCPU | RAM | $/hr (on-demand) | $/hr (preemptible, ~80% off) | Best For |
|---|---|---|---|---|---|
| e2-medium | 2 | 4 GB | $0.0335 | ~$0.010 | Light scans, single targets |
| n1-standard-2 | 2 | 7.5 GB | $0.0950 | ~$0.019 | General scanning (default) |
| n1-standard-4 | 4 | 15 GB | $0.1900 | ~$0.038 | Heavy scans, large target lists |
| n2-standard-2 | 2 | 8 GB | $0.0971 | ~$0.019 | General scanning (newer gen) |
| n2-standard-4 | 4 | 16 GB | $0.1942 | ~$0.039 | Parallel pipelines |
| c2-standard-4 | 4 | 16 GB | $0.2088 | ~$0.042 | CPU-intensive scans |
Preemptible Instances
Preemptible VMs cost up to 80% less than on-demand. They last at most 24 hours and can be reclaimed, but are ideal for security scanning workloads.Regions and Zones
Pick a region close to your targets or with the lowest pricing:| Region | Location | Code | Zone Example |
|---|---|---|---|
| Iowa | US | us-central1 | us-central1-a |
| South Carolina | US | us-east1 | us-east1-b |
| Oregon | US | us-west1 | us-west1-b |
| Frankfurt | Europe | europe-west3 | europe-west3-a |
| London | Europe | europe-west2 | europe-west2-a |
| Singapore | Asia | asia-southeast1 | asia-southeast1-a |
| Tokyo | Asia | asia-northeast1 | asia-northeast1-a |
| Mumbai | Asia | asia-south1 | asia-south1-a |
| Sydney | Australia | australia-southeast1 | australia-southeast1-a |
Note: The zone must be within the selected region.
Custom Image Family
Use a custom image family with tools pre-installed for faster startup:Cost Limits
Examples
Quick Domain Recon
Large-Scale Subdomain Enumeration
Custom Nmap Scan
Distributed Nuclei Scanning
Preemptible Instance Pipeline
Persistent Recon Campaign
Multi-Region Scanning
Troubleshooting
”Permission denied” or “403 Forbidden”
Your service account lacks required permissions. Assign the Compute Admin role:“Credentials file not found”
Make sure the JSON key file path is correct and the file exists:Instances Not Starting
”Compute Engine API has not been used” Error
Enable the Compute Engine API for your project:SSH Connection Timeout
Preemptible Instance Terminated
Preemptible VMs are reclaimed after 24 hours or when GCP needs capacity. The scan will fail for that worker. Mitigation:- Use
--auto-destroyto clean up - Re-run the failed targets
- Use on-demand instances for critical or long-running scans
Cleaning Up
Cost Optimization
- Use preemptible instances for all non-critical scans (
use_preemptible: true) — up to 80% savings - Right-size machines: e2-medium is enough for most single-target scans
- Always use
--auto-destroyto prevent forgotten instances - Set cost limits to catch runaway spending
- Use custom images to reduce setup time (less instance-hours)
- Pick the cheapest region if target geo-location doesn’t matter (us-central1 is usually cheapest)
- GCP sustained-use discounts apply automatically for on-demand VMs running more than 25% of the month
