r/aws • u/kshirinkin • Jul 01 '26
technical resource Self-hosted GitHub Actions runners on Lambda MicroVMs
I was curious if I can use new Lambda MicroVMs as self-hosted GitHub Runners. On paper, they are super nice:
- It's cheaper: GHA-hosted is $0.005 / min (2 vCPU), MicroVMs ~$0.0042 / min, and no minimum 60-second commitment as with GHA-hosted.
- It can run longer: GHA-hosted max 6 hours, MicroVMs max 8 hours
- It starts in a few seconds, compared to whichever other serverless solution built on top of ECS
- It scales to 0, or rather, it only runs when jobs are running
- They are VMs, so you can still run containers/docker/whatever else inside;
I got a bit too invested, and ended up building this Terraform module. You only need to create GitHub App manually, the rest is just a single "terraform apply" and your MicroVM Runners are ready to go. I've switched come of projects at my company to use, works great, same or better performance as GHA-provided runners. Natural limitation is that MicroVMs are only arm64, and in general they don't have much flexibility around the "hardware" setup - but hey, for most cases, it should work great, and it's just 1 webhook + GHA JIT Runners + 1 MicroVM Run per Job.
19
u/HiCookieJack Jul 01 '26
Have you tried codebuild hosted github runners?
There is no need for building something custom on top of ECS, scales to 0, no containers and quite a selection of runtime sizes and features.
It comfortably is setup through a naming-scheme you need to follow plus codeconnect
5
u/kshirinkin Jul 01 '26
sorry the module itself is here - https://github.com/mkdev-me/terraform-aws-github-runner-lambda-microvms/tree/main, together with the architecture overview. It's very simple though.
8
u/themisfit610 Jul 01 '26
I was thinking CI rubbers would indeed be a good fit for Lambda MicroVMs. Our k8s hosted gitlab runners are sometimes frustratingly slow to start.
6
u/Dull-Mathematician45 Jul 01 '26
EC2 spot in a cheap region (us-west-2, eu-north-1) is a much better deal. c8g.large $0.000447 per min on average, 90% cost savings compared to MicroVMs. I get a new instance in just a few seconds.
2
u/HatchedLake721 Jul 01 '26
Don’t you still have to pay for the baseline cost when Lamdba MicroVM is not running?
2
u/ultrathink-art Jul 02 '26
Ephemeral runners also quietly kill the worst failure mode of persistent ones — the runner process stays alive so systemd/launchd sees nothing wrong, but it silently stops polling and jobs sit queued forever. Got bitten by that enough on a long-lived runner that I ended up adding a watchdog to restart it whenever anything's been queued >30 min. A fresh VM per job makes that whole class of problem impossible.
1
u/iAziz786 Jul 02 '26
Did you hit the limit of running only one MicroVM at a time?
1
u/water_bottle_goggles Jul 02 '26
Very cool! I was thinking of building something similar too!
0
u/GreensLater Oct 05 '26
i move from GI’s runners to Avrea at an old job and it ended up cheaper than GH’s own per-minute rate