- Open AWS console - choose EC2 - choose Instances - Press Launch Instance
- Amazon machine image: Choose Amazon Linux 2 AMI (HVM), SSD Volume Type, click Next
- Instance type: Choose t3.medium, click Next
- Configure instance details - skip this step by clicking Next
- Storage: Add 20gb storage (gp2), click Next
- Tags: skip by clicking Next
- Create new security group for ssh 22 port (or use existing for ssh), click Review and Lauch
- Generate new ssh key-pair by entering name and downloading .pem file
- Once .pem is downloaded, set right chmod:
chmod 0600 filename.pem
- Open AWS console - choose EC2 - choose Instances
- Choose just-created instance, click Actions - Security - Change security groups
- Add existing cluster’s security group to ec2's security groups (it will give an access to the cluster to make deployments from the runner)
- Open AWS console - choose EC2 - choose Instances
- Click to the just-created instance to see detail page
- Click Connect - choose SSH client
- Run the suggested command to connect via ssh:
ssh -i "path-to-pem/filename.pen" ec2-user@HOST.compute.amazonaws.com
- Run following commands to setup required dependencies:
curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh" | sudo bash
sudo -E yum install gitlab-runner
sudo amazon-linux-extras install docker
sudo service docker start
sudo usermod -a -G docker ec2-user
sudo systemctl enable docker.service
sudo systemctl enable containerd.service
sudo yum install -y git
sudo gitlab-ci-multi-runner register -n --url GITLAB_URL --registration-token "TOKEN" --executor docker --description "Name of docker runner" --docker-image "docker:latest" --docker-privileged
GITLAB_URL and TOKEN can be obtained on GitLab CI/CD runners settings for the group/project.
Now you're able to use this runner.