0

Is there any way we can access an Amazon RDS database inside VPC from Lambda locally (now in AWS console)?

I am trying to run lambda locally but having an issue while accessing RDS because of VPC.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Tayyab
  • 329
  • 1
  • 16
  • Is the database in a Private subnet or a Public subnet? Is the database configured as "Publicly Available"? – John Rotenstein Dec 23 '21 at 20:48
  • If you need access locally resources from VPC, then you can use a client VPN with the VPC. However, maybe a public access with whitelisted IP on the security group is simpler to set up – gusto2 Dec 23 '21 at 20:54
  • Database is in private subnet and not configured as "Publicly Available" @JohnRotenstein – Tayyab Dec 24 '21 at 11:33

1 Answers1

2

Your database is not accessible from the Internet. This is excellent for security, but it means you cannot connect directly to the database.

You have a couple of options...

You could create a VPN Connection into the VPC and then connect to the database.

Or, you could SSH into a 'Jump Box' (or 'Bastion Server') while using Port Forwarding. See: StackOverflow: How EC2 allow SSH tunelling to access RDS in private subnet?

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470