【问题标题】:deploy cloudformation and add trigger to lambda function when done部署 cloudformation 并在完成后将触发器添加到 lambda 函数
【发布时间】:2018-09-23 13:48:39
【问题描述】:

对于自动部署工作流程,我想启动 cloudformation 部署并在完成后触发 lambda 函数。

我知道,我可以添加一个 cloudwatch 事件,该事件会在我的帐户中的 cloudformation 发生事件时触发。但我不想在 any 正在部署的 cloudformation 模板上触发 lambda,而只在模板上触发,我决定在模板上触发 lambda。

我可以向 lambda 函数添​​加代码,让它自行决定是否应该触发它。这可能会奏效,但我想知道是否有更好更直接的解决方案? 想法?

【问题讨论】:

    标签: amazon-web-services aws-lambda


    【解决方案1】:

    Custom resources 使您能够在 AWS CloudFormation 在您创建、更新时运行的模板

    例如:在创建 RDS 数据库后启用 RDS 日志的自定义 Lambda 资源。

    Resources:
      EnableLogs:
        Type: Custom::EnableLogs
        Version: '1.0'
        Properties:
          ServiceToken: arn:aws:lambda:us-east-1:acc:function:rds-EnableRDSLogs-1O6XLL6LWNR5Z
          DBInstanceIdentifier: mydb
    

    查看我的 python 要点here

    【讨论】:

      猜你喜欢
      • 2019-01-30
      • 2020-01-29
      • 2018-10-03
      • 2019-01-02
      • 1970-01-01
      • 2021-09-15
      • 2021-04-04
      • 1970-01-01
      • 2019-12-10
      相关资源
      最近更新 更多