是否可以通过AWS Lambda连接到本地计算机中托管的数据库 [英] Is it possible to connect to database hosted in local machine through AWS lambda

查看:185
本文介绍了是否可以通过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网关:无服务器离线

这篇关于是否可以通过AWS Lambda连接到本地计算机中托管的数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆