Skip to content

Latest commit

 

History

History

README.md

AWS EC2 as GitLab runner

Provision and configure GitLab runner on EC2 intance

Document

Provision step

0. Prepare

1. Initialize Terraform

cd aws-ec2-gitlab-runner
terraform init

2. Plan the Terraform Configuration

terraform plan -out "runner.tfplan.out"

3. Apply the Terraform Configuration

terraform apply "runner.tfplan.out"

⚠️ 4. Clean Up Resources

Once we do not need the Runner anymore, lets terminate it:

terraform destroy

Architecture

Once provisioning proccess completed, we will have the GitLab-AWS EC2 architecture as this flow

Debug

  • Connect to EC2 instance
# Open an SSH client.
# Locate your private key file. The key used to launch this instance is 'ec2-ssh-key.pem'
# Run this command, if necessary, to ensure your key is not publicly viewable.

chmod 400 "ec2-ssh-key.pem"

# Connect to your instance using its Public DNS: yourec2domain.compute-1.amazonaws.com

ssh -i "ec2-ssh-key.pem" ec2-user@yourec2domain.compute-1.amazonaws.com

## NOTE: Repace 'ec2-ssh-key.pem' by your key name
  • Debug gitlab runner service on EC2
systemctl status gitlab-runner.service