
Security News
/Research
Popular node-ipc npm Package Infected with Credential Stealer
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.
@layerborn/cdk-github-runners
Advanced tools
CDK construct to create GitHub Actions self-hosted runners. A webhook listens to events and creates ephemeral runners on the fly.
Use this CDK construct to create ephemeral self-hosted GitHub runners on-demand inside your AWS account.
Self-hosted runners in AWS are useful when:
Ephemeral (or on-demand) runners are the recommended way by GitHub for auto-scaling, and they make sure all jobs run with a clean image. Runners are started on-demand. You don't pay unless a job is running.
The best way to browse API documentation is on Constructs Hub. It is available in all supported programming languages.
A runner provider creates compute resources on-demand and uses actions/runner to start a runner.
| EC2 | CodeBuild | Fargate | Lambda | |
|---|---|---|---|---|
| Time limit | Unlimited | 8 hours | Unlimited | 15 minutes |
| vCPUs | Unlimited | 2, 4, 8, or 72 | 0.25 to 4 | 1 to 6 |
| RAM | Unlimited | 3gb, 7gb, 15gb, or 145gb | 512mb to 30gb | 128mb to 10gb |
| Storage | Unlimited | 50gb to 824gb | 20gb to 200gb | Up to 10gb |
| Architecture | x86_64, ARM64 | x86_64, ARM64 | x86_64, ARM64 | x86_64, ARM64 |
| sudo | ✔ | ✔ | ✔ | ❌ |
| Docker | ✔ | ✔ (Linux only) | ❌ | ❌ |
| Spot pricing | ✔ | ❌ | ✔ | ❌ |
| OS | Linux, Windows | Linux, Windows | Linux, Windows | Linux |
The best provider to use mostly depends on your current infrastructure. When in doubt, CodeBuild is always a good choice. Execution history and logs are easy to view, and it has no restrictive limits unless you need to run for more than 8 hours.
You can also create your own provider by implementing IRunnerProvider.
pip install layerborn.cdk-github-runners
npm i @layerborn/cdk-github-runners
<dependency>
<groupId>com.layerborn</groupId>
<artifactId>cdk.github.runners</artifactId>
</dependency>
go get github.com/layerborn/cdk-github-runners-go/layerborncdkgithubrunners
dotnet add package layerborn.Cdk.Github.Runners
GitHubRunners construct in your code (starting with default arguments is fine)aws --region us-east-1 lambda invoke --function-name status-XYZ123 status.json--profile too) and open the resulting status.json filegithub.setup.url from status.json or manually setup GitHub integration as an
app or with personal access tokengithub.auth.status and github.webhook.status are OKself-hosted label with runs-on: [self-hosted, linux, codebuild] or similarThe default providers configured by GitHubRunners are useful for testing but probably not too much for actual
production work. They run in the default VPC or no VPC and have no added IAM permissions. You would usually want to
configure the providers yourself.
For example:
let vpc: ec2.Vpc;
let runnerSg: ec2.SecurityGroup;
let dbSg: ec2.SecurityGroup;
let bucket: s3.Bucket;
// create a custom CodeBuild provider
const myProvider = new CodeBuildRunner(this, 'codebuild runner', {
label: 'my-codebuild',
vpc: vpc,
securityGroup: runnerSg,
});
// grant some permissions to the provider
bucket.grantReadWrite(myProvider);
dbSg.connections.allowFrom(runnerSg, ec2.Port.tcp(3306), 'allow runners to connect to MySQL database');
// create the runner infrastructure
new GitHubRunners(this, 'runners', {
providers: [myProvider],
});
Another way to customize runners is by modifying the image used to spin them up. The image contains the runner, any required dependencies, and integration code with the provider. You may choose to customize this image by adding more packages, for example.
const myBuilder = new CodeBuildImageBuilder(this, 'image builder', {
dockerfilePath: FargateRunner.LINUX_X64_DOCKERFILE_PATH,
runnerVersion: RunnerVersion.specific('2.291.0'),
rebuildInterval: Duration.days(14),
});
myBuilder.setBuildArg('EXTRA_PACKAGES', 'nginx xz-utils');
const myProvider = new FargateRunnerProvider(this, 'fargate runner', {
label: 'customized-fargate',
vpc: vpc,
securityGroup: runnerSg,
imageBuilder: myBuilder,
});
// create the runner infrastructure
new GitHubRunners(stack, 'runners', {
providers: [myProvider],
});
Your workflow will then look like:
name: self-hosted example
on: push
jobs:
self-hosted:
runs-on: [self-hosted, customized-fargate]
steps:
- run: echo hello world
Windows images must be built with AWS Image Builder.
const myWindowsBuilder = new ContainerImageBuilder(this, 'Windows image builder', {
architecture: Architecture.X86_64,
os: Os.WINDOWS,
runnerVersion: RunnerVersion.specific('2.291.0'),
rebuildInterval: Duration.days(14),
});
myWindowsBuilder.addComponent(new ImageBuilderComponent(this, 'Ninja Component',
{
displayName: 'Ninja',
description: 'Download and install Ninja build system',
platform: 'Windows',
commands: [
'Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-win.zip" -OutFile ninja.zip',
'Expand-Archive ninja.zip -DestinationPath C:\\actions',
'del ninja.zip',
],
}
));
const myProvider = new FargateRunnerProvider(this, 'fargate runner', {
label: 'customized-windows-fargate',
vpc: vpc,
securityGroup: runnerSg,
imageBuiler: myWindowsBuilder,
});
// create the runner infrastructure
new GitHubRunners(stack, 'runners', {
providers: [myProvider],
});
runs-on in the workflow matches the expected labels set in the runner providertroubleshooting.webhookHandlerUrl from status.json
workflow_job eventsgithub.auth.app.installationstroubleshooting.stepFunctionUrl
from status.json
FAQs
CDK construct to create GitHub Actions self-hosted runners. A webhook listens to events and creates ephemeral runners on the fly.
The npm package @layerborn/cdk-github-runners receives a total of 0 weekly downloads. As such, @layerborn/cdk-github-runners popularity was classified as not popular.
We found that @layerborn/cdk-github-runners demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
/Research
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.

Security News
TeamPCP and BreachForums are promoting a Shai-Hulud supply chain attack contest with a $1,000 prize for the biggest package compromise.

Security News
Packagist urges PHP projects to update Composer after a GitHub token format change exposed some GitHub Actions tokens in CI logs.