One approach can be save your Javascript code in AWS Lambda. It is useful in the case of if your javascript runs for very short duration. for details https://docs.aws.amazon.com/lambda/latest/dg/lambda-nodejs.html