Skip to content

Instantly share code, notes, and snippets.

@prog893
Last active July 22, 2022 15:19
Show Gist options
  • Save prog893/f6e4bc48ca652cc0ea865602350d775e to your computer and use it in GitHub Desktop.
Save prog893/f6e4bc48ca652cc0ea865602350d775e to your computer and use it in GitHub Desktop.
awscli aliases
# Prerequisites: awscli, jq
## Show role details for a Lambda function
function get-function-role() {
aws lambda get-function --function-name "$1" | jq '.Configuration.Role' -j | sed 's/.*\///' | xargs aws iam get-role --role-name | jq
}
## Show Lambda function resource-based policy
# Useful for debugging integration with other services (like API Gateway, ALB and EventBridge)
# since permissions for invocations from them are written here
function get-function-resource-policy() {
aws lambda get-policy --function-name $1 | jq '.Policy' -r | jq
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment