Deploying a GitLab Runner on AWS

Problem

I recently encountered an informational message on GitLab. I had used almost all the 400 minutes that the free tier provides for GitLab runners. I have previously run GitLab runners locally using Docker, however I wanted something to run in the cloud.

Setup

  1. Install docker with OrbStack or Docker Desktop on local machine
  2. Create a new VPC with 2 private subnets and that is connected to the internet via NAT gateway, allowing outbound traffic.
    • vpc-with-nat-and-instance-connect.yaml 
    • Run that cf template 

vpc-with-nat-and-instance-connect.yaml

3. Create a test instance in the new VPC and test connection 

Test connection to the new instance

5. Install Node: https://nodejs.org/en/download

Creation

  1. Create a new Repo in GitLab 
  2. Follow the AWS guide to step 6 to create and clone the repo
  3. Go to GitLab create a Person Access Token
    • + 
User Settings / Access tokens 
Search settings 
Q Search or go to ... 
Personal access tokens 
Add new token 
User settings 
You can generate a personal access token for each application you use that needs access to the GitLab API. You can also use personal access 
8 Profile 
tokens to authenticate against Git over HTTP. They are the only accepted password when you have Two-Factor Authentication (2FA) enabled. 
8¢ 
Account 
Your token 
Copy token 
X 
Billing 
Applications 
Make sure you save it - you won't be able to access it again. 
Integration accounts 
Access tokens 
Active tokens 
Tokens expiring in 2 weeks 
Revoked tokens 
Expired tokens 
Emails 
1 
0 
3 
3 
Password 
Filter list 
Filter list 
Filter list 
Filter list 
Notifications 
State 
= 
Active X 
X 
Q 
Expiration date v 
1= 
SSH Keys 
GPG keys 
Name 
Status 
Scopes 
Usage ? 
Lifetime 
º Preferences 
GitLabRunner 
api, ai_features, create_runner, 
Last used: 
Comment templates 
Active 
x in 4 weeks 
: 
GitLab Runner on 
manage_runner 
Never 
Aug 04, 2025 
Active sessions 
AWS
  4. Login to GitLab with token on your own CLI

5. Go To GitLab new repo: Deploy >>> Registry 

6. Copy the build command and run in the new repo

7. Push to the GitLab container registry 

8. Refresh GitLab container registry

9. Create a Runner and save the token output

10. Edit the runner to ensure it can run on multiple projects 

11. Create a properties file. Get the following: 

  • VPCID 
  • SubnetIds (2 private subnets) 
  • ImageID (An update AMI, use latest) 
  • Docker image path 
  • RunnersToken 
  • S3 bucket name (From the original CF template to set up the VPC) 

12. Run the deploy runner script. In my example, default is the name of the AWS profile I am using. You can find out the name of your profile using the commands below. If it is blank then it is default.

13. Runner is Online 

Testing

  1. Turn off Instance Runners 

2. Confirm AWS Runner 

3. Run a job to test and check in the AWS Lambda application logs

Leave a Comment

Your email address will not be published. Required fields are marked *