-
Notifications
You must be signed in to change notification settings - Fork 4k
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
grantSendMessages of encrypted SQS to Lambda function not generating kms:Decrypt permission #6609
Comments
Good catch! My instinct is to automatically add this permission in the role passed to Other option is to make sure this is documented somewhere that users who need it are going to find it. Probably both. @rix0rrr knows some about this and may have some opinions. |
I think this is about the Lambda reading from the queue, right, rather than having to do with |
The Lambda writing to the queue failed until we added
to the Lambda's ExecutionRoleDefaultPolicy. |
I have the same issue. Apparently |
Does If it only requires for the second case, can we check if private isKeyFromAnotherAccount(key: kms.IKey): boolean {
if (!(Construct.isConstruct(key))) {
return false;
}
const bucketStack = Stack.of(this);
const identityStack = Stack.of(key);
return bucketStack.account !== identityStack.account;
} |
In my case, everything is in the same account, yet a decrypt permission is still required to send messages. |
Added 'kms:Decrypt' action to `grantSendMessages` Fixes: #6609
I have the same issue when I create a FIFO queue with an EventBus target and set the following encryption value: I followed the instruction in this article but this also didn't fix the problem. When I change the encryption back to unencrypted, the messages are delivered to the queue. |
General Issue
We deployed a SQS queue to Account-A that is encrypted with a CMK that resides in Account-B. Permissions of CMK are set to grant allow kms:* to AccountPrincipal('Account-A').
Then we instantiate ourLambda function that is granted write permissions to ourQueue using ourQueue.grantSendMessages(ourLambda).
This results in
being added to ourLambdaExecutionRoleDefaultPolicy.
Lambda function execution failed with KMS AccessDeniedException when sending a message to ourQueue.
After adding
sqsKey.grantDecrypt(ourLambda);
the lambda function executes successfully.
The Question
Is
kms:Decrypt
strictly necessary to execute sendMessage to an SSE enabled SQS queue? Is this due to the CMK residing in a seperate AWS account?If so, should
kms:Decrypt
be added to the Lambda execution role policy when Queue.grantSendMessage(Lambda) is used?Environment
Other information
Thanks for the good work!
The text was updated successfully, but these errors were encountered: