-
Notifications
You must be signed in to change notification settings - Fork 630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow the usage of an encrypted AMI #2927
Comments
(random lurker here that just saw this issue) Wouldn't it make sense to go ahead and submit as a PR versus waiting to hear if you should? Saves an unneeded step. :-) |
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed if no further activity occurs. Thank you for your contributions. |
not stale :-) |
Hello @v-rosa , I have tried your shared encrypted AMI feature in the 2.4.0 release but I was not able to get the scale-up lambda to actually run an EC2 instance without adding following IAM permission to the role:
Did you maybe set some special permissions on the KMS key, so that this is not needed? |
Hello @marko-fabry indeed you are right, we're missing the Kms:CreateGrant permission I have it in my example, not sure why I missed it in the initial PR. Even though the Kms key policy allows a given identity to use the key, the KMS service also requires the permissions to be set on the user/role allowed to use the key. Edit: this not applies for grants, it can be set either on the key policy or IAM policy. See:
https://docs.aws.amazon.com/kms/latest/developerguide/grants.html I will try to open a PR today to fix this. Thanks for the report. |
Thank you :) Much appreciated. |
Meanwhile I started to load more context (I'm in PTO ehehe) it might work only with the KMS key policy. Can you share you KMS key policy uses to encrypt the AMI? |
In you KMS key policy try to add the following statement: "Effect": "Allow",
"Principal": {
"AWS": [
"arn:aws:iam::<account-number>:<root-or-iam-role>"
]
},
"Action": "kms:CreateGrant",
"Resource": "*"
} And try again to spin up some runners. With this permission on the key policy I could create runners without specifically add Kms:CreateGrant on the lambda policy. Later the CreateGrant permission in the KMS key policy should be more restricted, see https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#grant-authorization |
Hey @v-rosa , sorry for late response. I tried adding the policy statement you provided without the statement that allowed the
So I guess the allow on the lambda role is actually necessary. |
This should fix missing IAM permissions when running from encrypted AMI. See [this issue](#2927)
Seems that a new hot fix was released, closing this issue. |
Currently its not possible to use an AMI encrypted using an external KMS key.
Something like this would fix this issue. https://github.com/v-rosa/terraform-aws-github-runner/tree/allow-using-encrypted-ami
Would be great to have this feature, let me know if these changes are OK for a PR.
Co-authored with @rsmolinski
The text was updated successfully, but these errors were encountered: