This script can be used as bootstap script to register private Gitlab runner and configure runner to access AWS ECR. You can use Ubuntu 18 LTS AMI and launch AWS EC2 instance to host Gitlab runner.
Attach AWS IAM role to grant EC2 instance to access AWS ECR and push pull docker images.
Also awscli aws configure
command can be used or export AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
as environment variable.
Need to export GITLAB_RUNNER_TOKEN
and AWS_REGION
as variable to run script successfully.
#!/bin/bash