aws-samples / aws-lambda-ddns-function

Dynamically create Route 53 resource records using CloudWatch Events and Lambda
Apache License 2.0
236 stars 116 forks source link

Have to increase the Lambda function timeout to avoid KeyError: 'Item at line 61 #19

Closed mneeharika closed 7 years ago

mneeharika commented 7 years ago

Hi,

Even 90sec timeout for Lambda function is still causing the issue at below lines -

'Item': KeyError Traceback (most recent call last): File "/var/task/DDNS.py", line 64, in lambda_handler instance = instance['Item']['InstanceAttributes'] KeyError: 'Item'

I made the timeout to max (5min) and then the function worked. So, looks like the timeout in CF templates should be increased to more than 2min.

jicowan commented 7 years ago

The first time you run the function, it creates the DDB table. Although it usually completes within a minute, it could take longer. If you create the table manually or you add it to the CFN template [which I will try to do when I have time], you shouldn't need to set the timeout to 5m or 2m.