I am following this gitlab
article on autoscaling gitlab runner on AWS spot instances.
I have a terraform
code I need to execute and since these spot instances don't have an IAM role
attached to them (since they are automatically spinning up by the runner) it gives me this pretty obvious error:
Error creating VPC: UnauthorizedOperation: You are not authorized to perform this operation. Encoded authorization failure message
And this is my gitlab-runner config.toml
, In here, where I can define the IAM role to be attached when the spot instance is spinning up ?
[runners.machine]
IdleCount = 1
IdleTime = 1800
MaxBuilds = 3
MachineDriver = "amazonec2"
MachineName = "shared-gitlab-runner-%s"
MachineOptions = [
"amazonec2-access-key=<ommited>",
"amazonec2-secret-key=<ommited>",
"amazonec2-region=us-east-2",
"amazonec2-vpc-id=vpc-b76528dc",
"amazonec2-subnet-id=subnet-d274q29e",
"amazonec2-zone=c",
"amazonec2-use-private-address=true",
"amazonec2-tags=gitlab-aws-autoscaler,gitlab,true,gitlab-runner-autoscale,true",
"amazonec2-security-group=ssh",
"amazonec2-instance-type=t2.medium",
"amazonec2-request-spot-instance=true",
"amazonec2-spot-price=0.07",
"amazonec2-block-duration-minutes=60"
]
question from:
https://stackoverflow.com/questions/65880017/gitlab-runner-auto-scale-in-spot-instance-with-iam-role 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…