How to pause / resume a aws lambda function

victor m picture victor m · Jun 22, 2016 · Viewed 22.8k times · Source

For example I have lambda functions that consume messages from a KinesisStream. How do stop and resume the function so that I don't incur charges and I don't loose data in the stream.

I know that if the events keep failing, Kinesis will keep retrying and the cost can be very high.

I cannot delete the function because there is lots of automation around it through CloudFormation. Is there a way to stop and restart the function?

SOLUTION: http://alestic.com/2015/11/aws-lambda-kinesis-pause-resume

NOTE: Event sources for rules, log streaming, cannot be disable using the event source. You will not event get it in the list when calling the API using the SDK. For those you have to disable the Event Rule, or the Log Subscription.

Answer

Guy Harel picture Guy Harel · Mar 4, 2018

The updated Lambda console on AWS supports this in the UI now. Click on the Kinesis stream feeding your lambda function, toggle the "Enabled/Disabled" toggle at the bottom, and Save. This will essentially pause/resume your function.Screenshot - Toggling Kinesis input into Lambda