{"id":22803125,"url":"https://github.com/nikovirtala/cdk-github-actions-runner","last_synced_at":"2025-04-19T20:22:51.891Z","repository":{"id":46563262,"uuid":"257828898","full_name":"nikovirtala/cdk-github-actions-runner","owner":"nikovirtala","description":"Deploy self-hosted GitHub Actions runner to AWS Fargate using AWS Cloud Development Kit (CDK)","archived":false,"fork":false,"pushed_at":"2023-06-19T22:58:39.000Z","size":500,"stargazers_count":128,"open_issues_count":2,"forks_count":24,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-03-29T12:51:19.501Z","etag":null,"topics":["aws-ecs","aws-fargate","aws-fargate-application","cdk","cdk-examples","ecs-service","fargate"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nikovirtala.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-22T07:46:24.000Z","updated_at":"2025-03-14T21:45:33.000Z","dependencies_parsed_at":"2022-09-15T02:51:25.653Z","dependency_job_id":null,"html_url":"https://github.com/nikovirtala/cdk-github-actions-runner","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikovirtala%2Fcdk-github-actions-runner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikovirtala%2Fcdk-github-actions-runner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikovirtala%2Fcdk-github-actions-runner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikovirtala%2Fcdk-github-actions-runner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nikovirtala","download_url":"https://codeload.github.com/nikovirtala/cdk-github-actions-runner/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249792715,"owners_count":21326402,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-ecs","aws-fargate","aws-fargate-application","cdk","cdk-examples","ecs-service","fargate"],"created_at":"2024-12-12T09:09:02.316Z","updated_at":"2025-04-19T20:22:51.871Z","avatar_url":"https://github.com/nikovirtala.png","language":"TypeScript","readme":"# GitHub Actions runner on AWS Fargate\n\nThis repository contains an example how to run self-hosted GitHub Actions runners on AWS Fargate!\n\n## Construct\n\nThe solution presented in this repository is available as a Construct library in [NPM](https://www.npmjs.com/package/@cloudgardener/cdk-aws-fargate-github-actions-runner) and [GitHub](https://github.com/cloudgardener/cdk-aws-fargate-github-actions-runner).\n\nYou can import it to your project by:\n\n```ts\nimport { GithubActionsRunner } from \"@cloudgardener/cdk-aws-fargate-github-actions-runner\";\n```\n\n## Docker image\n\nDocker image is based on [`ubuntu:20.04`](https://hub.docker.com/_/ubuntu) / `focal`. I may consider moving back to `ubuntu:rolling` once https://github.com/actions/runner/issues/1584 is resolved.\n\nOn top the base image I have installed GitHub Actions Runner based on [About self-hosted runners](https://help.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners) in GitHub documentation.\n\n## Deployment\n\nThe application is deployed to AWS using [AWS Cloud Development Kit (AWS CDK)](https://docs.aws.amazon.com/cdk/latest/guide/home.html).\n\n- Store two parameters `GITHUB_ACCESS_TOKEN` and `GITHUB_ACTIONS_RUNNER_CONTEXT` in to SSM Parameter Store.\n  - For repository level runner set `GITHUB_ACTIONS_RUNNER_CONTEXT` value to `https://github.com/\u003cowner\u003e/\u003crepository\u003e`\n  - For organization level runner set `GITHUB_ACTIONS_RUNNER_CONTEXT` value to `https://github.com/\u003corganization\u003e`\n- Run `cdk synth --profile \u003cyour-aws-cli-profile\u003e`\n- Run `cdk deploy --profile \u003cyour-aws-cli-profile\u003e`\n- Wait a little while ...\n\nNow you should be able find your self-hosted runner from repository setting in GitHub:\n\n![](./self-hosted-runner-in-actions-settings.png \"Self-hosted runner in GitHub Actions Settings\")\n\nWe can see also from the Fargate Task Logs that the runner is successfully registered:\n\n![](./fargate-task-logs-in-aws-console.png \"Fargate Task Logs in AWS Console\")\n\n## Personal Access Token Scopes\n\nRegistering self-hosted runner to repository level requires admin access to the repository, and `repo` scope for the access token.\n\n![](./access-token-repo.png \"Settings \u003e\u003e\u003e Developer settings \u003e\u003e\u003e Personal access tokens\")\n\nRegistering self-hosted runner to Organization level requires admin access to the organization, and `admin:org` scope for the access token.\n\n![](./access-token-admin-org.png \"Settings \u003e\u003e\u003e Developer settings \u003e\u003e\u003e Personal access tokens\")\n\n## Price Comparision\n\nYou can read about the comparisions I made from [Price Comparision](docs/price-comparision.md) document.\n\n## Useful commands\n\n- `npm run build` compile typescript to js\n- `npm run watch` watch for changes and compile\n- `npm run test` perform the jest unit tests\n- `cdk deploy` deploy this stack to your default AWS account/region\n- `cdk diff` compare deployed stack with current state\n- `cdk synth` emits the synthesized CloudFormation template\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikovirtala%2Fcdk-github-actions-runner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnikovirtala%2Fcdk-github-actions-runner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikovirtala%2Fcdk-github-actions-runner/lists"}