以编程方式禁用和启用AWS Lambda触发器 [英] Disable and enable AWS lambda trigger programmatically

查看:77
本文介绍了以编程方式禁用和启用AWS Lambda触发器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法让我们禁用&以编程方式启用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.

  • 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触发器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆