How to kill/terminate a running AWS Lambda function?

There's no way to kill a running lambda. However, you can set concurrency limit to 0 to stop it from starting any more executions

e.g.

$ aws lambda put-function-concurrency --function-name my-function --reserved-concurrent-executions 0

https://docs.aws.amazon.com/lambda/latest/dg/concurrent-executions.html


To stop my Lambda function which was in an infinite loop because I had an error in its iterative logic to ListObjects within an S3 bucket, I simply altered the IAM policy that gave the Lambda function access to the S3 bucket causing it to fail and thus breaking out of my infinite loop which is designed to return from the Lambda function upon encountering an error.


Following on from ubi's answer, you can also set the concurrency via the AWS console. Go to the Lambda you want to stop and click on the Throttle button:

enter image description here

You will get a modal explaining the concurrency will be set to 0 and no more Lambdas will run:

enter image description here