To allow a AWS service to invoke a lambda function you need to apply permissions. The json
for this permission could look a little something like so:
{ "FunctionName": "someFunction", "StatementId": "1", "Action": "lambda:InvokeFunction", "Principal": "codecommit.amazonaws.com", "SourceArn": "arn:aws:codecommit:us-east-1:80398EXAMPLE:MyDemoRepo", "SourceAccount": "80398EXAMPLE" }
above taken from http://docs.aws.amazon.com/codecommit/latest/userguide/how-to-notify-lambda.html
A permission is easy enough to add using the command line interface (cli). See http://docs.aws.amazon.com/cli/latest/reference/lambda/add-permission.html. And it can be removed using the command at http://docs.aws.amazon.com/cli/latest/reference/lambda/remove-permission.html
What I cannot find is a way to list existing permissions. I've looked everywhere in the Lambda and the IAM GUI. I've looked at the list of cli commands for Lambda at http://docs.aws.amazon.com/cli/latest/reference/lambda/index.html#cli-aws-lambda - there seems to be no command to list permissions. I also looked at the iam commands for a laugh at http://docs.aws.amazon.com/cli/latest/reference/iam/index.html#cli-aws-iam. Nothing sticks out there.
So the question : how do you get a list of Lambda permissions? What am I missing here and if it is actually impossible, why? Hopefully some AWS experts out there who can shed light on this
To view a function's execution roleOpen the Functions page of the Lambda console. Choose the name of a function. Choose Configuration, and then choose Permissions.
AWS Lambda functions need permissions to interact with other AWS services and resources in your account. These permissions are set via an AWS IAM Role, which the Serverless Framework automatically creates for each service, and is shared by all functions in the service.
You can invoke Lambda functions directly using the Lambda console, a function URL HTTP(S) endpoint, the Lambda API, an AWS SDK, the AWS Command Line Interface (AWS CLI), and AWS toolkits.
You can use AWS Identity and Access Management (IAM) to manage access to the Lambda API and resources such as functions and layers. For users and applications in your account that use Lambda, you can create IAM policies that apply to IAM users, groups, or roles.
This one confused me, too. You can add a permission to a Lambda function with the aws lambda add-permission
command in the AWSCLI. You can remove a permission using aws lambda remove-permission
. But to see the existing permissions you use aws lambda get-policy
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With