Guide
GCP and SkyPilot from a swarm
Already use SkyPilot on GCP? Four steps let swarm agents launch clusters in your project.
Optional: install the CLI
Skip if already works. Signing in opens a browser once.
curl -fsSL https://acyclic.dev/install.sh | sh acyclic swarm login --site https://acyclic.dev
1. Allow SSH through IAP
Swarm boxes reach your VMs through Google's IAP, so port 22 must accept it. Skip the last command if your network already allows SSH from anywhere.
PROJECT=$(gcloud config get project) gcloud services enable iap.googleapis.com --project $PROJECT gcloud compute firewall-rules create allow-iap-ssh --project $PROJECT \ --network default --allow tcp:22 --source-ranges 35.235.240.0/20
2. Copy your key into the folder
Use the service-account key SkyPilot already uses, in the folder you start the swarm from.
cp "$GOOGLE_APPLICATION_CREDENTIALS" gcp-sa.key
3. Start the swarm
Start the task with these lines. Each agent signs in, then uses as you do.
acyclic swarm run --dir . --include gcp-sa.key --watch --task "First run: acyclic-gcp-setup --key gcp-sa.key Launch clusters with: sky launch -y -i 15 --down ... When done, run: sky down -a -y Then: <your task>"
4. Clean up
Clusters delete themselves after 15 idle minutes. Check, then remove the key copy.
sky status --refresh rm gcp-sa.key
No key? Use your gcloud login
Pack it instead of step 2, upload it with , and make the first task line .
tar -czf gcloud.tgz -C ~/.config/gcloud credentials.db configurations \ active_config application_default_credentials.json
Optional: a key just for the swarm
Create a separate account and key instead of step 2:
SA=acyclic-swarm@$PROJECT.iam.gserviceaccount.com
gcloud iam service-accounts create acyclic-swarm --project $PROJECT
for role in editor iap.tunnelResourceAccessor iam.serviceAccountUser; do
gcloud projects add-iam-policy-binding $PROJECT --member serviceAccount:$SA \
--role roles/$role --condition None --quiet > /dev/null
done
gcloud iam service-accounts keys create gcp-sa.key --iam-account $SA Delete it when the swarm is done:
gcloud iam service-accounts delete $SA --quiet rm gcp-sa.key
Take the result
Wait for the swarm to finish, then apply its patch to your checkout. The change is staged, so review it with .
acyclic swarm watch <id> acyclic swarm pull <id> --apply git diff --cached
Cost
Swarms are billed at cost (sandbox time plus model usage) against prepaid credit, then a card. New accounts get $5 of credit. GCP bills you directly for the VMs. Each swarm has a budget cap, and the dashboard's Billing page shows every charge.
How it works
- installs and SkyPilot in the agent's box and signs in with your key.
- creates VMs in your project, billed to you, just like from your laptop.
- The agent connects to them over SSH through IAP, runs the job and keeps the results.
Notes
- Every agent can use the key, so set a budget alert.
- The key's account needs the IAP tunnel role (). Project owners have it.
- GCP only for now.
More: this guide as markdown, for agents · first swarm · CLI guide · SkyPilot quickstart