Terraform AWS Gitlab Runner

Terraform module for AWS GitLab runners on ec2 (spot) instances

Blockchain & Cloud ComputingHCLMIT

Abstract

Terraform AWS Gitlab Runner is an open-source Blockchain & Cloud Computing project. Terraform module for AWS GitLab runners on ec2 (spot) instances. See issue 819 on how to migrate to v7 smoothly. See pr 1204 on how to migrate to v8 smoothly. It is built using HCL, Terraform, AWS. Key capabilities include: Shared cache in S3 with life cycle management to clear objects after x days; Logs streamed to CloudWatch; Runner agents registered automatically. The complete source code is publicly available on GitHub under the MIT License, making it a useful reference for students building a Blockchain & Cloud Computing mini project or final-year project.

1. Introduction

See issue 819 on how to migrate to v7 smoothly. See pr 1204 on how to migrate to v8 smoothly.

This Terraform modules creates a GitLab Runner. A blog post describes the original version of the runner. See the post at 040code. The original setup of the module is based on the blog post: Auto scale GitLab CI runners and save 90% on EC2 costs.

The runners created by the module use spot instances by default for running the builds using the docker+machine executor.

2. Objective

Terraform module for AWS GitLab runners on ec2 (spot) instances

This project demonstrates how HCL, Terraform, AWS can be applied to a real-world Blockchain & Cloud Computing problem.

3. Key Features / Modules

  • Shared cache in S3 with life cycle management to clear objects after x days.
  • Logs streamed to CloudWatch.
  • Runner agents registered automatically.
  • GitLab CI docker-machine runner - one runner agent
  • GitLab CI docker-machine runner - multiple runner agents
  • GitLab Ci docker runner

4. Technology Stack

HCLTerraformAWS

5. System Requirements

General requirements for this technology stack — check the README for exact versions.

  • Terraform CLI
  • Cloud provider account (e.g. AWS) with CLI configured
  • Git (to clone the repository)

6. Installation & Setup

git clone https://github.com/cattle-ops/terraform-aws-gitlab-runner.git
cd terraform-aws-gitlab-runner

Full setup instructions are in the project README.

7. Future Enhancements

Suggested extensions you can add to make this your own project.

  • Add a CI/CD pipeline with GitHub Actions
  • Deploy to a public test network or cloud free tier
  • Add monitoring and cost alerts

8. Viva / Review Questions

Common questions examiners ask for projects in this domain.

  1. Why does this problem need a blockchain or cloud-native design?
  2. Explain the smart contract / infrastructure components and how they interact.
  3. How are gas costs or cloud costs kept under control?
  4. How is the system secured (keys, IAM, access control)?
  5. How would the solution scale to many more users?

9. Source Code & License

This project is developed by cattle-ops and published on GitHub under the MIT License. Please follow the license terms and credit the original author when you use or modify this code.

Want to build this as your internship project?

Work on a Blockchain & Cloud Computing project like this with mentor guidance, weekly reviews and an internship certificate from Training Trains, Erode — online or offline.

Apply for Blockchain & Cloud Computing Internship