Sandeep Prabhu
Sandeep Prabhu

Reputation: 109

How to pass the cloudwatch target input as a parameter to Lambda function

I added a cloudwatch event target input in the json format

{ "config": us}

And I tried to get this event as a input in my Lambda function as

def lambda_handler(event, context):

      con = event['config']

But this is not working , actually when I print just event , I am not getting any values

I tried con = event.config

def lambda_handler(event, context):

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

Upvotes: 2

Views: 1944

Answers (1)

Dejan Peretin
Dejan Peretin

Reputation: 12089

This should work:

def lambda_handler(event, context):

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

Maybe the problem is that { "config": us} is not a valid json. Try with { "config": "us"}

Upvotes: 4

Related Questions