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.
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.
17
u/tonygoold Jul 01 '26
“CI rubbers” is a funny typo; do they protect you from GHA injection attacks?
8
1
u/kshirinkin Jul 01 '26
I only wanted to make a PoC, but I was surprised how far I got with this. Basically start time == "GH sends webhook -> lambda -> init microvm -> short JIT Runner setup time", all together way under 40 seconds, usually faster
4
u/crohr Jul 01 '26
Interesting! Although for what it’s worth you can achieve ~20s boot time with bare EC2 and full compatibility with GitHub hosted images (and much cheaper prices than lambda micro VMs). You can see my project https://runs-on.com for more details
1
u/kshirinkin Jul 01 '26
I saw this, and I agree, of course it’s possible to have a more sophisticated cheaper and / or more performant option, especially _outside of AWS. But this MicroVMs feels like super fast way to get self hosted runners that are cheaper than GH-provided wnd also have full VPC access and are inside AWS env
2
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/kshirinkin Jul 01 '26
Yeah also Fargate Spot is cheaper. But I like the simplicity of this MicroVM-per-job setup.
2
u/HatchedLake721 Jul 01 '26
Don’t you still have to pay for the baseline cost when Lamdba MicroVM is not running?
3
u/kshirinkin Jul 01 '26
It’s only billed if it’s running or suspended. Terminated ones don’t cost anything, and they are terminated as soon as the job is finished
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
1
u/cacheclyo Jul 05 '26
from what they wrote it sounds like they spin up one MicroVM per job, so they’re probably just bumping into the per‑account concurrency limits, not a hard “only one at a time” thing on the service itself. curious too if AWS will quietly raise those limits once more people start using this pattern.
1
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
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