Skip to content

Self-Hosted Runners (Feature Guide)

Run Controlinfra scans in your own infrastructure for enhanced security and unlimited scans.

Why Self-Hosted Runners?

BenefitDescription
SecurityCloud credentials (AWS, Azure, GCP) never leave your network
ComplianceMeet regulatory requirements (SOC2, HIPAA, PCI)
Unlimited ScansNo quota limits
Network AccessScan private resources
Custom EnvironmentYour Terraform version, custom providers

Architecture

Cloud Runner (Default)

┌─────────────────────────────────────────────────────────┐
│                  Controlinfra Cloud                      │
│  ┌─────────────┐    ┌───────────────────────────────┐  │
│  │   Cloud     │    │                               │  │
│  │   Runner    │───▶│    Your AWS Resources         │  │
│  │             │    │                               │  │
│  └─────────────┘    └───────────────────────────────┘  │
│        │                                                │
│  AWS Credentials                                        │
│  stored here                                            │
└─────────────────────────────────────────────────────────┘

Self-Hosted Runner

┌─────────────────────────────────────────────────────────┐
│                  Your Infrastructure                     │
│  ┌─────────────┐    ┌───────────────────────────────┐  │
│  │ Self-Hosted │    │                               │  │
│  │   Runner    │───▶│    Your AWS Resources         │  │
│  │             │    │                               │  │
│  └──────┬──────┘    └───────────────────────────────┘  │
│         │                                               │
│   IAM Role                                              │
│   (no keys)                                             │
└─────────┼───────────────────────────────────────────────┘
          │ Results only

┌─────────────────────────────────────────────────────────┐
│                  Controlinfra Cloud                      │
│  • Dashboard                                            │
│  • AI Analysis                                          │
│  • Notifications                                        │
└─────────────────────────────────────────────────────────┘

Getting Started

For detailed setup instructions, see: Self-Hosted Runners Setup Guide

Quick Overview

  1. Create IAM Role with ReadOnlyAccess + Terraform state S3 permissions
  2. Launch EC2 Instance with the IAM role attached
  3. Install Dependencies (Terraform, Git)
  4. Register Runner in Controlinfra
  5. Install Agent and start

Required Permissions

The runner needs:

  • ReadOnlyAccess (AWS managed policy) for drift detection
  • S3 access to your Terraform state bucket (s3:GetObject, s3:PutObject, s3:ListBucket)
  • DynamoDB access for state locking (if used)

See AWS Credentials Guide for detailed policy examples.

Supported Platforms

Self-hosted runners can be deployed on any of the three major cloud providers or on-premise:

PlatformDeploymentCredentials
AWSEC2 Instance with IAM RoleInstance Profile, AssumeRole, or Access Keys
AzureVirtual Machine with Managed IdentityAzure CLI, Managed Identity, or Service Principal
GCPCompute Instance with Service AccountApplication Default Credentials or Service Account Key
On-PremiseAny Linux/macOS serverStatic credentials for target cloud provider

Auto-Update

Runners support automatic updates driven by the heartbeat mechanism:

  • On each heartbeat, the runner checks for script updates from the Controlinfra API
  • When an update is available, the runner downloads and applies the new version automatically
  • A job lock safety mechanism ensures updates never interrupt an in-progress scan -- the update waits until the current job completes
  • No manual intervention required; runners stay current with the latest features and fixes

Runner Features

Multiple Runners

Run multiple runners for:

  • High Availability: Redundant scanning
  • Environment Isolation: Separate prod/staging
  • Geographic Distribution: Multi-region
┌─────────────────────────────────────────────────────────┐
│               Controlinfra Cloud                         │
└───────────────────────┬─────────────────────────────────┘

        ┌───────────────┼───────────────┐
        │               │               │
        ▼               ▼               ▼
┌───────────────┐ ┌───────────────┐ ┌───────────────┐
│ Runner: prod  │ │ Runner: staging│ │ Runner: eu    │
│ us-east-1     │ │ us-east-1     │ │ eu-west-1     │
└───────────────┘ └───────────────┘ └───────────────┘

Runner Labels

Tag runners to route scans appropriately:

yaml
Runner: prod-runner
Labels:
  - production
  - us-east-1
  - high-security

Runner: staging-runner
Labels:
  - staging
  - us-east-1

Then in repository settings:

yaml
Repository: production-infra
Runner: Self-hosted
Labels: production, us-east-1

Auto-Selection

Controlinfra automatically selects the best runner:

  1. Matches labels if specified
  2. Chooses least busy runner
  3. Falls back to cloud runner if none available

Runner Management

Dashboard

View all runners in Settings → Runners:

┌─────────────────────────────────────────────────────────┐
│ Self-Hosted Runners                                     │
├─────────────────────────────────────────────────────────┤
│ ● prod-runner     │ Online │ us-east-1    │ 5 min ago  │
│ ● staging-runner  │ Online │ us-east-1    │ 2 min ago  │
│ ○ backup-runner   │ Offline│ us-west-2    │ 3 hrs ago  │
├─────────────────────────────────────────────────────────┤
│ [+ Add Runner]                                          │
└─────────────────────────────────────────────────────────┘

Runner States

StateIconDescription
Online🟢Ready to accept scans
Busy🟡Currently running a scan
Offline🔴Not connected
Error⚠️Error state, needs attention

Actions

ActionDescription
View LogsSee runner activity
Edit LabelsUpdate routing labels
Regenerate TokenNew authentication token
RemoveDelete runner registration

Authentication Methods

Self-hosted runners unlock authentication options that aren't available with the cloud runner — anything that requires the scanner to run inside your cloud account (Instance Profile, Managed Identity, Workload Identity) is only usable from a self-hosted runner.

MethodDescriptionBest For
Instance Profile (AWS)Use the runner's EC2 IAM role directlySingle AWS account setups
Assume Role (AWS)Runner assumes a different IAM roleCross-account, multi-tenant
Access Keys (AWS)Traditional access keys (also works with cloud)Quick setup
Managed Identity (Azure)Use the VM's assigned identitySingle Azure subscription
Service Principal (Azure)Azure AD app credentialsCross-subscription
Application Default Credentials (GCP)Use the instance's service accountSingle GCP project
Service Account Key (GCP)JSON key file for a GCP service accountCross-project

Trust requirements per method

For who Controlinfra authenticates as, what (if anything) needs to be trusted on Controlinfra's side, and which methods require a self-hosted runner, see the canonical "Trust requirements at a glance" tables:

  • AWS — Access Keys, Instance Profile, Assume Role (3a control-plane vs 3b runner-chained), OIDC
  • Azure — Service Principal, Managed Identity, OIDC
  • GCP — Service Account Key, Workload Identity

Recommended: Instance Profile or Assume Role

For production environments, avoid storing access keys. Instance Profile and Assume Role provide:

  • No credentials to rotate
  • Better audit trails
  • Temporary, auto-expiring credentials

For detailed setup instructions, see AWS Authentication Guide.

Security Considerations

No Credential Exposure

With self-hosted runners:

  • Cloud credentials (AWS, Azure, GCP) stay in your network
  • Use IAM roles, Managed Identities, or Service Accounts instead of static keys
  • Controlinfra only receives scan results

Network Security

Recommended setup:

  • Runner in private subnet
  • NAT Gateway for outbound
  • No inbound access required
  • Security group: outbound HTTPS only

Audit Trail

All runner activity is logged:

  • Scan requests
  • Results uploaded
  • Errors and failures

Performance

Scan Speed

Self-hosted runners can be faster:

  • Direct network access to AWS
  • No credential exchange latency
  • Configurable instance size

Scaling

For high scan volume:

yaml
# Multiple runners share load
prod-runner-1 (labels: production)
prod-runner-2 (labels: production)
prod-runner-3 (labels: production)

Resource Requirements

WorkloadInstance TypeNotes
Lightt3.smallFew scans/day
Mediumt3.mediumRegular scans
Heavyt3.large+Many concurrent scans

Troubleshooting

Runner Won't Connect

  1. Check network connectivity:
    bash
    curl https://api.Controlinfra.com/health
  2. Verify token is correct
  3. Check firewall rules

Scans Failing

  1. Check Terraform is installed
  2. Verify IAM permissions
  3. Review runner logs

Runner Goes Offline

  1. Check EC2 instance status
  2. Verify runner service is running
  3. Check for resource exhaustion

Cost Optimization

EC2 Costs

  • Use Spot Instances for non-critical scans
  • Right-size based on workload
  • Use Reserved Instances for steady usage

Comparison

ApproachProsCons
Cloud RunnerNo infrastructureQuota limits
Self-HostedUnlimited, secureEC2 costs

Next Steps