Fleeting plugin exits because of missing AWS Region
This is my UserData for my EC2 linux instance:
UserData:
Fn::Base64: !Sub |
#!/bin/bash
sudo yum update -y
sudo yum install -y docker
sudo service docker start
sudo curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh | sudo bash
sudo curl -L -o /bin/fleeting-plugin-aws https://gitlab.com/gitlab-org/fleeting/fleeting-plugin-aws/-/releases/v0.4.0/downloads/fleeting-plugin-aws-linux-386
sudo chmod +x /bin/fleeting-plugin-aws
sudo yum install -y gitlab-runner
# Register the GitLab Runner
sudo gitlab-runner register --non-interactive --url "x" --registration-token "${GitLabRegistrationToken}" --executor "docker-autoscaler" --description "aws autoscaling docker runners" --tag-list "awsautoscaler" --run-untagged="false"
sudo usermod -a -G docker gitlab-runner
# Create config.toml with Docker Autoscaler configuration
echo '
[[runners]]
name = "general-windows-2019-docker"
url = "x"
token = "${GitLabRegistrationToken}"
shell = "sh"
environment = ["FF_USE_POWERSHELL_PATH_RESOLVER=1"]
executor = "docker-autoscaler"
[runners.docker]
image = "mcr.microsoft.com/windows/servercore:ltsc2019"
[runners.autoscaler]
plugin = "fleeting-plugin-aws"
capacity_per_instance = 4
max_use_count = 100
max_instances = 3
[runners.autoscaler.plugin_config]
name = "${AutoScalingGroup}"
[runners.autoscaler.connector_config]
username = "Administrator"
protocol = "winrm"
use_external_addr = true
[[runners.autoscaler.policy]]
idle_count = 5
idle_time = "20m0s"' | sudo tee /etc/gitlab-runner/config.toml
# Start GitLab Runner
sudo gitlab-runner start
The runner got registered but never connected, so I remoted to the machine and got this:
[ssm-user@ip-10-19-162-205 bin]$ sudo gitlab-runner start
Runtime platform arch=amd64 os=linux pid=2439 revision=865283c5 version=16.1.0
[ssm-user@ip-10-19-162-205 bin]$ sudo gitlab-runner run
Runtime platform arch=amd64 os=linux pid=2466 revision=865283c5 version=16.1.0
Starting multi-runner from /etc/gitlab-runner/config.toml... builds=0
Running in system-mode.
Configuration loaded builds=0
listen_address not defined, metrics & debug endpoints disabled builds=0
[session_server].listen_address not defined, session endpoints disabled builds=0
Initializing executor providers builds=0
2023-06-30T07:28:11.526Z [WARN] plugin: plugin configured with a nil SecureConfig
2023-06-30T07:28:11.526Z [DEBUG] plugin: starting plugin: path=/bin/fleeting-plugin-aws args=["fleeting-plugin-aws"]
2023-06-30T07:28:11.526Z [DEBUG] plugin: plugin started: path=/bin/fleeting-plugin-aws pid=2474
2023-06-30T07:28:11.526Z [DEBUG] plugin: waiting for RPC address: path=/bin/fleeting-plugin-aws
2023-06-30T07:28:11.535Z [DEBUG] plugin.fleeting-plugin-aws: plugin address: network=unix address=/tmp/plugin2577408768 timestamp=2023-06-30T07:28:11.535Z
2023-06-30T07:28:11.535Z [DEBUG] plugin: using plugin: version=0
2023-06-30T07:28:11.537Z [TRACE] plugin.stdio: waiting for stdio data
2023-06-30T07:28:11.539Z [DEBUG] plugin.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2023-06-30T07:28:11.540Z [INFO] plugin: plugin process exited: path=/bin/fleeting-plugin-aws pid=2474
2023-06-30T07:28:11.540Z [DEBUG] plugin: plugin exited
WARNING: Failed to process runner builds=0 error=failed to update executor: initializing taskscaler: creating taskscaler: initializing provisioner: instance group init: rpc error: code = Unknown desc = describing autoscaling groups: operation error Auto Scaling: DescribeAutoScalingGroups, failed to resolve service endpoint, an AWS region is required, but was not found executor=docker-autoscaler runner=x
Where can I define the AWS region, or where is it gathered from?
I'm using ami-0ca7795427fb03aa0 for the managing machine