In this section, you will install and configure GitLab Runner on an Amazon EC2 instance. GitLab Runner acts as the compute worker agent that picks up CI/CD pipeline jobs from your GitLab repository and executes build, container packaging, and deployment scripts directly against AWS services.
GitLab CI/CD separates the orchestrator (GitLab server) from the execution agents (GitLab Runners).
In this lab, we configure a Shell Executor hosted on an Amazon EC2 build instance:

Create a dedicated tools directory on the EC2 instance:
sudo nano /tools/setup.sh

Add the following installation script to /tools/setup.sh:
#!/bin/bash
# Update package list
apt update -y
# Install GitLab Runner
curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh" | sudo bash
apt install gitlab-runner
# Check version
gitlab-runner --version

Make the script executable and run the installation:
sudo chmod +x /tools/setup.sh
sudo /tools/setup.sh
Verify that the GitLab Runner binary is installed and operational:
gitlab-runner --version

Verify that the background system service is active. Expected Status: active (running).
sudo systemctl status gitlab-runner --no-pager
In your forked GitLab repository, navigate to the left sidebar:

Under Project runners, click Create project runner.

Configure the runner parameters:
fcaj-lab-runner-be and press Enter.
Tags are used in .gitlab-ci.yml files (via the tags keyword) to route specific build jobs to designated runners. For example, fcaj-lab-runner-be ensures backend tasks run exclusively on this runner.
After creating the runner in the UI, GitLab displays the registration command containing your unique authentication token
Run the registration command on your EC2 instance:
Provide the configuration values when prompted:
https://gitlab.com (or type https://gitlab.com).fcaj-lab-runner-beshell

Run the runner under the GitLab Runner service or verify the runner daemon in the background:
# Switch to root and start runner in background
sudo -i
su - gitlab-runner
nohup gitlab-runner run > start-runner-be.txt 2>&1 &
# Check live runner log
tail -n 20 start-runner-be.txt

To enable parallel execution and clean separation of concerns, create a second runner dedicated to frontend assets:
Return to GitLab: Settings → CI/CD → Runners → Click Create project runner.

Configure the frontend runner:
fcaj-lab-runner-fe and press Enter.
Copy the new token and register on the EC2 terminal: When prompted:
https://gitlab.comfcaj-lab-runner-feshell
| Runner Name | Executor | Expected Status | |
|---|---|---|---|
| fcaj-lab-runner-be | shell | Online (Green indicator) | |
| fcaj-lab-runner-fe | shell | Online (Green indicator) |

If a runner shows an offline status (gray/black dot), restart the runner service with sudo systemctl restart gitlab-runner and refresh the page.