【问题标题】:How to pass the cloudwatch target input as a parameter to Lambda function如何将 cloudwatch 目标输入作为参数传递给 Lambda 函数
【发布时间】:2019-04-04 19:05:15
【问题描述】:

我添加了一个json格式的cloudwatch事件目标输入

{“配置”:我们}

我试图在我的 Lambda 函数中将此事件作为输入作为

def lambda_handler(event, context):

      con = event['config']

但这不起作用,实际上当我只打印事件时,我没有得到任何值

我试过 con = event.config

def lambda_handler(event, context):

    con = event.config
    con1 = event['config']
    print (con)
    print (con1)

【问题讨论】:

    标签: python amazon-web-services aws-lambda amazon-cloudwatch


    【解决方案1】:

    这应该可行:

    def lambda_handler(event, context):
    
        con1 = event['config']
        print (con1)
    

    也许问题在于{ "config": us} 不是有效的 json。试试{ "config": "us"}

    【讨论】:

    • 谢谢,解决了问题
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-08-15
    • 2020-12-23
    • 2016-04-09
    • 2021-07-16
    • 2020-06-08
    • 1970-01-01
    • 2018-10-26
    相关资源
    最近更新 更多