Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable and enable AWS lambda trigger programmatically

Is there a way for us to disable & enable the Lambda trigger programmatically (e.g. for scheduled maintains purposes)?

enter image description here

like image 636
Yuchen Avatar asked Jan 30 '26 03:01

Yuchen


1 Answers

You can disable and enable Lambda triggers by using following approaches with Update Event Source Mapping, based on how you are going to do it.

  • Using AWS CLI: You can use AWS CLI update-event-source-mapping command with --enabled | --no-enabled parameters.
  • Using AWS SDK (E.g NodeJS): You can use AWS SDK updateEventSourceMapping method with Enabled: true || false attribute.

  • Using AWS REST API: You can use AWS REST API UpdateEventSourceMapping with "Enabled": boolean attributes.

Note: You need to grant relevant permission for each of the approach to execute using IAM Roles/Users or temporarily access credentials.

like image 143
Ashan Avatar answered Feb 01 '26 16:02

Ashan