-1

I have an RDS db and an RDS Proxy handling my connections to it. RDS Proxy is only accessible from within the same VPC. I want to be able to locally test a Lambda I've written to connect to it. If I use serverless-offline will the fact I'm running it locally prevent it from accessing the proxy? I have the lambda all setup deployed in the correct VPC.

I've attempted to run it locally and access it and have so far been unsuccessful. However, I'm uncertain as to whether that's due to it being impossible, or whether I've implemented it incorrectly.

SebJS74
  • 21
  • 3

1 Answers1

0

It sounds like you are trying to run serverless locally, but connect to your live RDS-Proxy in AWS?

serverless-offline, is for local testing.. i.e.: sls offline start, then disconnect your internet, then interact with your locally running app, and it still works.

Of course, you could just attempt to connect to live services from your local running environment. But a better pattern is to create a 'connection builder' that knows how to connect to a local DB or the live DB, based on serverless stage ...

With all that said.. you can always run an EC2 instance in the same VPC, with permission to connect to the RDS Proxy, then create an SSH tunnel to the EC2 instance, and bridge a localhost port to the rds proxy. ha!

alphaadidas
  • 332
  • 2
  • 6
  • Yeah, I soon figured that it was not possible using serverless offline. I was having issues with connecting to RDS-Proxy and was hoping to be able to step through it. Your last suggestion did run through my mind. Eventually got it running regardless. Thanks for the help. – SebJS74 Apr 26 '23 at 15:47
  • You were able to get RDS PRoxy working with serverless-offline? Mine sharing how? – Cody Swann Aug 31 '23 at 02:27