AWS Serverless Offline and MS-SQL Database

Viewed 241

I have an AWS Lambda that runs in a serverless offline environment. The lambda saves some data in MS-SQL (not AWS RDS) database through a stored procedure in an on-prem MS-SQL database. The Lambda currently uses node mssql package which works fine from AWS. To test, the Lambda needs to be published in AWS and then from there the lambda has to be run to connect to the MS-SQL Database which is on-prem.

I want the lambda in the serverless environment to connect to the MS-SQL database on the same machine. How can I do the same test using the serverless offline so I don't need to publish the lambda to AWS to connect to the on-prem database?

1 Answers

You can invoke lambda functions locally if you have a SAM template using SAM cli. You will need to have docker installed on you machine and then you can use the command:

sam local invoke

this is a link to AWS documentation: link to documentation

Related