问题描述
有没有办法让我们禁用&以编程方式启用Lambda触发器(例如出于计划维护的目的)?
Is there a way for us to disable & enable the Lambda trigger programmatically (e.g. for scheduled maintains purposes)?
推荐答案
您可以根据要执行的操作通过更新事件源映射使用以下方法来禁用和启用Lambda触发器
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.
- 使用AWS CLI:您可以使用AWS CLI 的noreferrer> update-event-source-mapping 命令|--no-enabled 参数.
-
使用AWS开发工具包(例如NodeJS):您可以使用AWS开发工具包 Enabled的rel ="noreferrer"> updateEventSourceMapping 方法:true ||false 属性.
- 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.
使用AWS REST API:您可以使用AWS REST API 具有"Enabled":boolean
属性的UpdateEventSourceMapping .
Using AWS REST API: You can use AWS REST API UpdateEventSourceMapping with "Enabled": boolean
attributes.
注意:您需要为每种方法授予相关权限,以使用IAM角色/用户执行操作或临时访问凭据.
Note: You need to grant relevant permission for each of the approach to execute using IAM Roles/Users or temporarily access credentials.
这篇关于以编程方式禁用和启用AWS Lambda触发器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!