Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
722 views
in Technique[技术] by (71.8m points)

amazon web services - Gitlab runner auto-scale in Spot instance with IAM ROLE

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...