aws-sam-cli
aws-sam-cli copied to clipboard
Proposal: Use template credentials for sam local
The goal here is to be able to properly test the configured IAM Roles/Policies for the Lambda(s) before deploying, running, dig through logs, find the error, update Lambda and repeat.
To do this I am thinking of doing the following, I would love to know if there is a better way.
- parse SAM template for Functions
- create an IAM user "sam-local-function-name"
- UPSERT ~/.aws/config & ~/.aws/credentials
- UPSERT Polices/Roles defined in the template to the "sam-local-function-name" user
- execute
sam local invoke… —profile sam-local-<function-name>
I agree that this would be a great feature. In terms of implementation, I would much more prefer something like the policy simulator (docs).
This is a duplicate of https://github.com/aws/aws-sam-cli/issues/332, which was closed. Closure response can be found here: https://github.com/aws/aws-sam-cli/issues/332#issuecomment-1218371195