Skip to content

Automate the management of your GitHub Actions runner on AWS to minimize costs

License

Notifications You must be signed in to change notification settings

nodesource/aws-eco-runner

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

AWS Eco Runner

Automate the management of your GitHub Actions runner on AWS to minimize costs

Overview

AWS Eco Runner is a solution designed to optimize the cost of using GitHub Actions runners on AWS. By automating the activation and deactivation of the instance, it ensures that you only incur costs when necessary. The runner is kept active every 2 days (to not be removed as a Github Runner) and turned off when not in use, providing a cost-effective approach to managing GitHub Actions workflows.

Usage

    steps:
      # Configure AWS Credentials
      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v4
        with:
          aws-region: us-west-2
          role-to-assume: $ARN_IAM_ROLE

      - name: Start Runner
        uses: nodesource/aws-eco-runner@v1
        with:
          instance_id: '["i-01", "i-02"]'
          action: 'start'
          aws_default_region: 'us-west-2'

        ...

      - name: Stop Runner
        uses: nodesource/aws-eco-runner@v1
        with:
          instance_id: '["i-01"]'
          action: 'stop'
          aws_default_region: 'us-west-2'

This action requires a minimal permission to start and stop the instance: This is an example IAM policy, you must adapt it to your needs.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "VisualEditor0",
      "Effect": "Allow",
      "Action": ["ec2:StartInstances", "ec2:StopInstances"],
      "Resource": ["arn:aws:ec2:${REGION}:${ACCOUNT_ID}:instance/${INSTANCE_ID}"]
    }
  ]
}

About

Automate the management of your GitHub Actions runner on AWS to minimize costs

Resources

License

Stars

Watchers

Forks

Packages

No packages published