Use RemovePermission with an Amazon SDK or CLI - Amazon Lambda
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Use RemovePermission with an Amazon SDK or CLI

The following code examples show how to use RemovePermission.

Amazon CLI

To remove permissions from an existing Lambda function

The following remove-permission example removes permission to invoke a function named my-function.

aws lambda remove-permission \ --function-name my-function \ --statement-id sns

This command produces no output.

For more information, see Using Resource-based Policies for Amazon Lambda in the Amazon Lambda Developer Guide.

Tools for PowerShell

Example 1: This example removes the function policy for the specified StatementId of a Lambda Function.

$policy = Get-LMPolicy -FunctionName "MylambdaFunction123" -Select Policy | ConvertFrom-Json| Select-Object -ExpandProperty Statement Remove-LMPermission -FunctionName "MylambdaFunction123" -StatementId $policy[0].Sid
  • For API details, see RemovePermission in Amazon Tools for PowerShell Cmdlet Reference.

For a complete list of Amazon SDK developer guides and code examples, see Using Lambda with an Amazon SDK. This topic also includes information about getting started and details about previous SDK versions.