Issue using a single lambda to access RDS resource on VPC and access internet

0

I have an RDS on a VPC with a security group and 2 subnets. I have a lambda that needs to query the RDS and then upload this information to a third party via the internet. When I try to use this lambda without attaching the security group / subnets, I can access the internet, but not the RDS. When I attach the security group / subnets, I can access the RDS, but not the internet. The security group allows all traffic both inbound and outbound. What are the exact steps do I need to take to accomplish my objective? I'm trying to go for a full serverless approach, and this function only needs to run once per day (for around ~10 seconds), so I'd like to not have to pay for a server that needs to run 24/7 to accomplish this objective.

  • Following up, I don't really understand route tables or the difference between internet gateways and NAT gateways, so please keep this in mind when explaining how to solve this problem. Thanks in advance!

  • Following up, the two subnets that are currently attached look to be public subnets, because 0.0.0.0 is targeted at an internet gateway.

    I've tried adding another subnet that targets 0.0.0.0 at a NAT gateway, but this did not solve the problem either.

Andrew
asked 2 months ago123 views
1 Answer
0

Hello Andrew,

Can you try looking at this article ? https://repost.aws/knowledge-center/internet-access-lambda-function

AWS
EXPERT
answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions