AWS Lambda Container destroy event

Viewed 6421

When to release connections and cleanup resources in lambda. In normal Node JS application we do use the hook

process.on('exit', (code) => {
    console.log(`About to exit with code: ${code}`);
});

However this doesn't work on AWS Lambda. Resulting the Mysql connection in sleep mode. We don't have enough resource for such active connections. None of the AWS documentation specify a way to achieve this.

How to receive stop event of AWS Lambda container ?

1 Answers
Related