Aws lambda describe instances time out

Viewed 6542

I have this simple describe instances function that I'm trying to run in nodejs via AWS Lambda:

var AWS = require('aws-sdk');
AWS.config.region = 'us-east-1';

exports.handler = function(event, context) {
    console.log("\n\nLoading handler\n\n");
    var ec2 = new AWS.EC2();
    ec2.describeInstances(function(err, data) {
        console.log("\nIn describe instances:\n");
      if (err) {
        console.log(err, err.stack); 
        context.done(null, 'Function Finished from error!');  // an error occurred
      }else {   
        console.log("\n\n" + data + "\n\n");
        context.done(null, 'Function Finished with data!');   // successful response 
      }
    });
};

This does not return me any errors the only output in CloudWatch is this:

2016-03-21T17:01:59.085Z xxxxxxx-xx.... Task timed out after 3.00 seconds

Anyone have any idea what could be the problem?

3 Answers

I also faced same issue.. I increased timeout( Lambda --> Configuration --> Advanced Settings) from 3 seconds to 5 seconds and it worked fine.

Related