This example demonstrates how to configure EC2 providers for GitHub self-hosted runners on Windows.
- EC2 with Windows: Use EC2 to run Windows runners
- Windows image builder: Build custom Windows runner images with additional tools
- VPC configuration: Configure VPC, subnets, and security groups
EC2 is useful when you want:
- Complete control over the runner instance
- Direct access to the host operating system
- Long-running instances that can be reused
- Custom instance configurations
- Windows runners typically require more resources than Linux runners
- Chocolatey is used for package management on Windows
- Windows instances may take longer to start than Linux instances
-
Install dependencies:
pip install -r requirements.txt
-
Deploy the stack:
cdk deploy
-
Follow the setup instructions in the main README.md to configure GitHub integration.
-
Use the runners in your GitHub Actions workflows:
name: Build on EC2 Windows
on: push
jobs:
build:
runs-on: [self-hosted, ec2, windows, x64]
steps:
- uses: actions/checkout@v5
- run: echo "Running on EC2 Windows instance"
- run: choco --versionYou can customize the EC2 Windows provider by:
- Configuring
instanceTypefor different instance sizes - Adding custom components to the image builder (PowerShell commands)
- Configuring
storageSizefor larger disk space - Using spot instances for cost savings
To remove the stack:
cdk destroy