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?
I also faced same issue.. I increased timeout( Lambda --> Configuration --> Advanced Settings) from 3 seconds to 5 seconds and it worked fine.
Check this: https://medium.com/@philippholly/aws-lambda-enable-outgoing-internet-access-within-vpc-8dd250e11e12#.2sdn5oyd1
If you are in VPC, you can't access Internet anymore!
You should configure NAT to enable outgoing internet access in lambda.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With