1

Im trying to pass below event keys to AWS lambda python function.

Payload='{"OS":"ubuntu","region":"us-east-1","subnetids":"'subnet-123','subnet-456','subnet-789','subnet-101112'","vpcid":"vpc-abcd"}')

facing issue passing subnetids to lambda function as its a list not a single item.

And in actual fucntion not sure how to read this payload as events itself is an array

i can read OS ,region as event["OS"],event["region"] but not sure how to read subnetids as if i try event["subnetids"] its trying to read as single value not as list of subnets

Please suggest!!

1 Answer 1

4

Your example isn't proper json. To make it such, you'll need to wrap your subnets in array and change the quoting like:

Payload='{"OS":"ubuntu","region":"us-east-1","subnetids":["subnet-123", "subnet-456","subnet-789","subnet-101112"],"vpcid":"vpc-abcd"}'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.