Lambda connection to RDS timeout

0

I am trying to establish a connection from my lambda function to RDS instance (Aurora MySQL) using TypeORM

Scenario 1:

When trying to connect to RDS instance using mysql2 driver and using creds (host, database name, username, password), the **connection **timeout

Scenario 2:

When trying to connect to RDS instance using typeorm-aurora-data-api-driver driver and using creds (resourceARN, secretARN), the **lambda **timeout

Note :

  • I successfully established a connection to the DB using Mysql Workbench

  • Lambda Timeout is set to 30s

Scenario 1:

Scenario 1

Scenario 1

Scenario 2:

Scenario 2

Scenario 2

1개 답변
2

Hello.

Is Lambda connected to the same VPC as RDS?
If you are not connected, please connect to VPC by following the steps in the document below.
https://docs.aws.amazon.com/lambda/latest/dg/configuration-vpc.html#vpc-configuring

Make sure that you allow the Lambda function's security group connection in the RDS security group inbound rule.
https://repost.aws/knowledge-center/connect-lambda-to-an-rds-instance

profile picture
전문가
답변함 한 달 전
profile picture
전문가
검토됨 한 달 전
profile picture
전문가
검토됨 한 달 전
profile pictureAWS
전문가
검토됨 한 달 전
  • Lambda's VPC is connected to the RDS VPC via VPC peering I checked the security group, all traffic is allowed (for testing purposes)

  • Have you checked the route table of the subnet that Lambda is linked to? A route to the VPC peering must be configured in the route table. This requires that the route to the VPC peering be set in the RDS subnet route table as well. In other words, the settings must be configured to allow communication between VPCs in both directions.

  • I checked the VPC peering Connections in the "Edit DNS Setting" and it turned out that I wasn't enabling the "resolve DNS of requester VPC hosts to private IP." checkbox in both VPCs (Accepter VPC and Requester VPC) and this solved the issue , but am wondering why this checkbox solved the issue while in the inbound rules of the VPC I was allowing all Mysql aurora traffic Ipv4 connections along with the CIDR entries connections from the Peer VPC ?

  • The VPC needs to resolve public IPv4 DNS hostnames to private IPv4 addresses when queried from instances in the peer VPC. Here is more detail. https://repost.aws/knowledge-center/vpc-peering-troubleshoot-dns-resolution

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠