Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call a list of AWS Lambda permissions for a function

Tags:

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

like image 576
James Jones Avatar asked Jun 13 '16 09:06

James Jones


People also ask

How can I see Lambda permissions?

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.

How are permissions provided to Lambda functions?

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.

How do you call a lambda function?

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.

Which mechanism allows you to control who has access your AWS Lambda function?

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.


1 Answers

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.

like image 87
garnaat Avatar answered Sep 19 '22 08:09

garnaat