I need the syntax for python to enable and disable lambda function programmatically
I have checked boto3 I couldn't find any or am I missing something not sure please help
Thank you.
I need the syntax for python to enable and disable lambda function programmatically
I have checked boto3 I couldn't find any or am I missing something not sure please help
Thank you.
The link provided is about enabling/disabling event source mapping for a lambda function. This can be done using update_event_source_mapping in boto3 with Enabled option:
Enabled (boolean) -- If true, the event source mapping is active. Set to false to pause polling and invocation.
However, this only disables the mapping, not the function itself. There is no API call to disable a function. Your function still will be invokable, just not through the source mappings.
As a workaround which somehow can mimic "disabling" a function, is to deny its invocation or remove invocation permissions from any IAM user/role which shouldn't be able to invoke it.
As a work around, for disabling lambda, you can set concurrency to 0 using https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/lambda.html#Lambda.Client.put_function_concurrency
And you can enable by setting it to a positive number.