DEV Community

Discussion on: AWS KMS use case with Serverless Application Model (SAM): An end to end solution

Collapse
 
jingxue profile image
Jing Xue

Nice work. The lambda doesn't seem to be using keyUser's credentials though? Does its service role have access to the key as well?

Collapse
 
rajanpanchal profile image
Rajan Panchal

Key access is given in lamdba policy.

Collapse
 
jingxue profile image
Jing Xue

The policy only grants $keyUser access to the key, not the lambda itself. The lambda code still has to authenticate as $keyUser at some point. Where is that done?

Thread Thread
 
rajanpanchal profile image
Rajan Panchal

With that Policy, an inline policy for Lamdba is created and assigned to the execution role to have access to key. Lamdba doesn't use KeyUser.

Thread Thread
 
jingxue profile image
Jing Xue

Ok, that's what I thought. You don't really need the $keyUser statement. For using the key, it would probably be more portable to grant access to a role instead of a user anyway.