Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Missing Permission for Spot Instance Creation #7

Open
MartinLoeper opened this issue Nov 16, 2018 · 5 comments
Open

Missing Permission for Spot Instance Creation #7

MartinLoeper opened this issue Nov 16, 2018 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@MartinLoeper
Copy link

I use spot instances for runners.
However, after setting GitLabRunnerSpotInstance to "Yes", the manager could not create the new machines and the logs stated that:

Error creating machine: Error in driver during machine creation: Error request spot instance: AuthFailure.ServiceLinkedRoleCreationNotPermitted: The provided
credentials do not have permission to create the service-linked role for EC2 Spot Instances.

I had to add "iam:CreateServiceLinkedRole" for resource "*" to the manager's inline policy "Runners".
I got the information from a related issue: LeanerCloud/AutoSpotting#187

@fquffio fquffio added the bug Something isn't working label Nov 18, 2018
@fquffio fquffio self-assigned this Nov 18, 2018
@fquffio
Copy link
Contributor

fquffio commented Nov 18, 2018

Hi @MartinLoeper ! Thanks a lot for your interest in this project and your report.

I'm afraid I tested this on an account that already had a service linked role, so the iam:CreateServiceLinkedRole permission was not needed. 😱

I might try to force the creation of the service-linked role in the CloudFormation template to ensure it's present, but I wonder if that will work… 🤔

@MartinLoeper
Copy link
Author

Hi @fquffio, unfortunately I do not know which service linked role has to be created there. 😆

I just wanted to make it work as quickly as possible and adding the permission above works well.
If you come up with a proper solution, I might test it on our infrastructure.

@fquffio
Copy link
Contributor

fquffio commented Nov 19, 2018

I'll try to open a PR in the afternoon, but I'm afraid you'd have to delete all service-linked roles before testing… 😞

I might try to find an AWS account in which I have never used spot instances. 🤔

@mpgo13
Copy link
Contributor

mpgo13 commented Mar 22, 2019

I ran into the same issue. Here the PR #12

@lamoglia
Copy link

Looks like AWS creates the AWSServiceRoleForEC2Spot role automatically on the first ever spot instance request.
So, if you make a spot request via aws (web), it will probably solve your problem

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants