是否可以通过AWS Lambda连接到本地计算机中托管的数据库

问题描述:

我在AWS中启动了一个RDS实例,s3和EC2,并使用lambda正确触发了它.现在,我希望将RDS和EC2的更改从AWS更改为本地计算机.我的lambda是从s3触发的.

I launched one RDS instance,s3 and EC2 in AWS and its is triggered properly using lambda. Now I wish to change the change the RDS and EC2 from AWS to local machine. My lambda is triggered from s3.

如何通过AWS中的lambda连接本地数据库?

How do I connect the local database through lambda in AWS?

我同意John Rotenstein的观点,即将本地计算机连接到在AWS上运行的Lambda可能是一个坏主意.

I agree with John Rotenstein that connecting your local machine to a Lambda running on AWS is probably a bad idea.

如果您打算在本地进行开发或测试,则建议使用无服务器框架和无服务器脱机插件.它将允许您在本地模拟Lambda,并且可以将数据库配置值作为环境变量进行传递.

If your intention is to develop or test locally, I recommend the serverless framework, and the serverless-offline plugin. It will allow you to simulate Lambda locally, and you can pass database config values through as environment variables.

请参阅:在本地运行AWS Lambda和API网关:无服务器离线