How to temporarily disable an AWS Lambda function using AWS CLI without removing the function

This article is a part of my "100 data engineering tutorials in 100 days" challenge. (51/100)

Occasionally, we must quickly disable an AWS Lambda without removing it. It may happen when we accidentally deploy incorrect code, when a lack of input validation causes it to propagate erroneous data downstream, or when we must disable an application function for safety reasons.

When this happens, we don’t need to remove the lambda function or its triggers. That would be a terrible solution because we would have to restore it later, and that may create more bugs. Instead of that, we can use the concurrency configuration to prevent the function from running.

If the concurrency is set to 0, the function will not run.

1
aws lambda put-function-concurrency --function-name function_name --reserved-concurrent-executions 0

Did you enjoy reading this article?
Would you like to learn more about software craft in data engineering and MLOps?

Subscribe to the newsletter or add this blog to your RSS reader (does anyone still use them?) to get a notification when I publish a new essay!

Newsletter

Do you enjoy reading my articles?
Subscribe to the newsletter if you don't want to miss the new content, business offers, and free training materials.

Bartosz Mikulski

Bartosz Mikulski

  • Data/MLOps engineer by day
  • DevRel/copywriter by night
  • Python and data engineering trainer
  • Conference speaker
  • Contributed a chapter to the book "97 Things Every Data Engineer Should Know"
  • Twitter: @mikulskibartosz
Newsletter

Do you enjoy reading my articles?
Subscribe to the newsletter if you don't want to miss the new content, business offers, and free training materials.