Overview
The setup process involves three main steps:- CloudFormation Infrastructure — Deploy our template to create VPC, security groups, IAM roles, and launch templates
- On-Demand Instance Spawning — Use
spawn-runner.shto launch TestDriver instances when you need to run tests - CI/CD Integration — Automate the lifecycle in GitHub Actions: spawn instance → run tests → terminate instance
Prerequisites
Before you begin, ensure you have:- AWS account with CloudFormation permissions
- AWS CLI installed and configured (
aws configure) - Access to the TestDriver AMI — Contact us with your AWS region
- A GitHub repository for your tests
Step 1: Deploy CloudFormation Stack
Our CloudFormation template creates all the AWS infrastructure you need:- Dedicated VPC with public subnet
- Security group with required port access
- IAM roles and instance profiles
- EC2 launch template for instance creation
Get Your Launch Template ID
After deployment completes, retrieve the launch template ID:Step 2: Spawn Test Instances
Use thespawn-runner.sh script to launch instances on-demand. This script:
- Launches a new EC2 instance using your launch template
- Waits for the instance to be ready
- Completes the TestDriver handshake
- Returns instance details for test execution
Run Tests Against Your Instance
With Vitest, specify the instance IP using theTD_VM environment variable:
Terminate Instances
Always terminate instances after tests complete to avoid unnecessary costs:Instances are tagged with
Name=TestDriverRunner and your ProjectTag for easy identification in the AWS console.Step 3: GitHub Actions Integration
Automate the full lifecycle in your CI/CD pipeline. This workflow spawns an instance, runs tests, and terminates the instance:.github/workflows/test.yml
Required GitHub Secrets
| Secret | Description | Example |
|---|---|---|
AWS_ACCESS_KEY_ID | AWS access key | AKIAIOSFODNN7EXAMPLE |
AWS_SECRET_ACCESS_KEY | AWS secret key | wJalrXUtnFEMI/K7MDENG... |
AWS_REGION | AWS region | us-east-2 |
AWS_LAUNCH_TEMPLATE_ID | From CloudFormation output | lt-07c53ce8349b958d1 |
AMI_ID | TestDriver AMI ID | ami-086b5b4b86d78987c |
TD_API_KEY | Your TestDriver API key | From console.testdriver.ai |
AMI Customization
The TestDriver Golden Image comes pre-configured with:- Windows Server with desktop environment
- VNC + web server for remote access
- Python, Node.js, Git
- TestDriver agent and dependencies
Creating a Custom AMI
You can customize the AMI to include additional software or configurations:1
Connect via RDP
Use the default credentials:
- Username:
testdriver - Password:
changemeABC123
2
Change the Password
Critical: Run the password rotation script immediately:Save the new password securely.
3
Install Your Software
Install any additional dependencies, configure settings, or modify the environment as needed.
4
Create New AMI
Use the AWS console or CLI to create an AMI from your modified instance. Update your workflow to use the new AMI ID.
Changing Screen Resolution
Set resolution via environment variable when spawning:lifecycle/provision.yaml
Security Best Practices
Network Security
- Restrict CIDR blocks — Only allow access from known IP ranges
- Use VPC endpoints — For private AWS service communication
- Enable VPC Flow Logs — For network monitoring
AWS Authentication
Use OIDC instead of long-term credentials for GitHub Actions:Instance Security
- Terminate immediately after tests complete
- Monitor costs with AWS billing alerts
- Use least-privilege IAM roles
- Enable CloudTrail for audit logging
Troubleshooting
Instance Not Responding
- Check security groups — Verify required ports are open (RDP 3389, VNC 5900, TestDriver ports)
- Verify status checks — Ensure instance has passed AWS status checks
- Check AMI compatibility — Some instance types don’t support certain AMIs
Connection Timeouts
- Verify network connectivity from CI runner to instance
- Check VPC routing and internet gateway configuration
- Confirm instance is in the correct subnet
AWS CLI Errors
- Validate credentials and permissions
- Check service quotas and limits
- Verify region consistency across all resources

