AWS, Cloud Computing, DevOps

3 Mins Read

A Guide to Configure a Self-hosted GitHub Runner on an Amazon EC2 Machine

Introduction

GitHub Actions provide a powerful and flexible platform for automating workflows directly within your GitHub repository. Configuring a self-hosted GitHub runner on an Amazon EC2 machine becomes valuable when you require more control over your build environment. This blog post guides you through setting up a self-hosted runner on Amazon EC2.

Prerequisites

Before you begin, ensure you have the following:

  • An active GitHub repository.
  • An Amazon EC2 instance with a valid SSH key pair.
  • AWS CLI is installed locally for convenient Amazon EC2 instance setup.

Pioneers in Cloud Consulting & Migration Services

  • Reduced infrastructural costs
  • Accelerated application deployment
Get Started

Step-by-Step Guide

Step 1: Launching an Amazon EC2 Instance

Launch an Amazon EC2 instance using the AWS Management Console or AWS CLI. Make sure to select an instance type that aligns with your workload requirements. Note down the public IP address or DNS of the instance.

Step 2: Installing Dependencies on Amazon EC2

SSH into the Amazon EC2 instance and install the necessary dependencies:

Step 3: Select the repository on which you want to have the runners and click on New-Self-hosted-runner.

step3

Step 4: Select the runner image according to your server Operating system.

step4

Step 5: GitHub provides the detailed commands to run on your Amazon EC2 server to configure the runners, download the commands, and run them as shell scripts, or you can run each command on the server.

step5

Step 6: The server will authenticate with GitHub with the runner token and enable your server to be listed as a hosted runner.

step6

step6b

step6c

Step 7: Once the runner is configured then the server will be visible as hosted runners in your GitHub account.

step7

Conclusion

Configuring a self-hosted GitHub runner on an Amazon EC2 instance gives you greater control over your build environment, enabling customized workflows tailored to your project’s needs.

With this setup, you can take full advantage of GitHub Actions while maintaining the flexibility of your infrastructure.

Drop a query if you have any questions regarding Self-hosted GitHub and we will get back to you quickly.

Making IT Networks Enterprise-ready – Cloud Management Services

  • Accelerated cloud migration
  • End-to-end view of the cloud environment
Get Started

About CloudThat

CloudThat is a leading provider of Cloud Training and Consulting services with a global presence in India, the USA, Asia, Europe, and Africa. Specializing in AWS, Microsoft Azure, GCP, VMware, Databricks, and more, the company serves mid-market and enterprise clients, offering comprehensive expertise in Cloud Migration, Data Platforms, DevOps, IoT, AI/ML, and more.

CloudThat is recognized as a top-tier partner with AWS and Microsoft, including the prestigious ‘Think Big’ partner award from AWS and the Microsoft Superstars FY 2023 award in Asia & India. Having trained 650k+ professionals in 500+ cloud certifications and completed 300+ consulting projects globally, CloudThat is an official AWS Advanced Consulting Partner, AWS Training Partner, AWS Migration Partner, AWS Data and Analytics Partner, AWS DevOps Competency Partner, Amazon QuickSight Service Delivery Partner, Amazon EKS Service Delivery Partner, Microsoft Gold Partner, AWS Microsoft Workload Partners, Amazon EC2 Service Delivery Partner, and many more.

To get started, go through our Consultancy page and Managed Services PackageCloudThat’s offerings.

FAQs

1. Can I use a self-hosted GitHub runner across multiple repositories?

ANS: – Yes, a self-hosted GitHub runner can be used across multiple repositories. During the runner configuration

2. What security considerations should I be aware of when using self-hosted GitHub runners?

ANS: – When using self-hosted GitHub runners, consider the following security best practices:

  • Access Controls: Ensure only authorized individuals can access the self-hosted machine and runner configuration files.
  • Token Management: Safeguard your access tokens used during runner configuration. Avoid hardcoding tokens directly in scripts or configuration files.
  • Update Regularly: Keep your self-hosted machine and all dependencies up-to-date with the latest security patches.
  • Isolation: Consider using dedicated machines for self-hosted runners to avoid potential security risks associated with sharing the environment.
  • Firewall Rules: Configure firewall rules to restrict network access to only necessary services and ports.

WRITTEN BY Rekha S

Share

Comments

    Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!