Aws lambda AWS Lambda连接到Docker中的本地Postgres
我正试图从Lambda函数连接到作为docker容器运行的本地Postgres服务器 我正在使用Aws lambda AWS Lambda连接到Docker中的本地Postgres,aws-lambda,Aws Lambda,我正试图从Lambda函数连接到作为docker容器运行的本地Postgres服务器 我正在使用samlocalinvoke调用来执行此操作 出于某种原因,SAM的docker容器的函数传出连接似乎已禁用 我收到以下错误消息: "errorMessage": "(psycopg2.OperationalError) could not connect to server: Connection refused\n\tIs the server running on host \"localhos
samlocalinvoke
调用来执行此操作
出于某种原因,SAM的docker容器的函数传出连接似乎已禁用
我收到以下错误消息:
"errorMessage": "(psycopg2.OperationalError) could not connect to server: Connection refused\n\tIs the server running on host \"localhost\" (127.0.0.1) and accepting\n\tTCP/IP connections on port 5432?\ncould not connect to server: Cannot assign requested address\n\tIs the server running on host \"localhost\" (::1) and accepting\n\tTCP/IP connections on port 5432?\n\n(Background on this error at: http://sqlalche.me/e/e3q8)",
是否有办法启用对本地docker数据库的Lambda函数调用
我在Lambda函数之外以标准Python代码运行连接代码时没有问题,因此我确信我的数据库已启动,代码正常工作,等等。请尝试根据AWS SAM CLI使用
-docker network TEXT
运行该命令
我试图使用本地Docker Postgres数据库运行sam本地启动api
时遇到类似问题,并且连接被拒绝错误。我运行了sam本地启动api-docker网络主机,它解决了这个问题
这是一个很好的帖子,它帮助我更多地了解了
希望这有助于你和任何其他人看到这一点