user3647101
user3647101

Reputation: 55

AWS sam local invoke on remote resources

I am trying to run a lambda function written in Go using AWS sam local invoke, but cannot connect to the dynamodb running in the cloud.

I've tried tunneling and portforwarding to the database in Putty. Specifying the host and port to my own ip and port.

The command I use to run the lambda: sam local invoke -t ./qa.yaml -e ./s3_event.json

I expect that it should run the lambda, but it gives this connection error:

tcp 192.168.x.xxx:5433: connect: connection refused","data":{"database":"analytics"}}

Upvotes: 0

Views: 1819

Answers (1)

user3647101
user3647101

Reputation: 55

The problem was using 127.0.0.1 as my host. I had to switch it to host.docker.internal.

source: https://docs.docker.com/docker-for-mac/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host

Upvotes: 1

Related Questions