0

I am trying to connect to my Redshift database (located in N. Virginia region) from Lambda function (located in Ireland region). But on trying to establish a connection, I am getting timeout error stating:

"errorMessage": "2019-10-20T13:34:04.938Z 5ca40421-08a8-4c97-b730-7babde3278af Task timed out after 60.05 seconds"

I have closely followed the solution provided to the AWS Lambda times out connecting to RedShift but the main issue is that the solution provided is valid for services located in same VPC (and hence, same region).

On researching further, I came across Inter-region VPC Peering and followed the guidelines provided in AWS Docs. But after configuring VPC Peering also, I am unable to connect to Redshift

Here are some of the details that I think can be useful for understanding the situation:

  1. Redshift cluster is publicly accessible, running port 8192 and has a VPC configured (say VPC1)
  2. Lambda function is located in another VPC (say VPC2)

  3. There is a VPC Peering connection between VPC1 and VPC2

  4. CIDR IPv4 blocks of both VPCs are different and have been added to each other's Route tables (VPC1 has 172.31.0.0/16 range and VPC2 has 10.0.0.0/16 range)

  5. IAM Execution role for Lambda function has Full Access of Redshift service

  6. In VPC1, I have a security group (SG1) which has an inbound rule of type: Redshift, protocol: TCP, port: 5439 and source: 10.0.0.0/16

  7. In VPC2, I am using default security group which has outbound rule of 0.0.0.0/0

  8. In Lambda, I am providing private IP of Redshift (172.31.x.x) as hostname and 5439 as port (not 8192!)

  9. Lambda function is in NodeJS 8.10 and I am using node-redshift package for connecting to Redshift

  10. After all this, I have tried accessing Redshift with both public IP as well as through its DNS name (with port 8192)

Kindly help me out in establishing connection between these services.

  • 2
    "IAM Execution role for Lambda function has Full Access of Redshift service" is probably unnecessary unless you want the Lambda function to create new Redshift servers. You didn't mention the security group rules assigned to the Redshift server, please add that information to your question. – Mark B Oct 20 '19 at 14:57
  • Have you configured the Lambda function in Ireland region to run in a VPC? If not, then the traffic will be routed over internet and your request will always timeout as you are providing the private IP address. – Yeshodhan Kulkarni Oct 20 '19 at 18:25
  • @YeshodhanKulkarni Yes, I have configured VPC for the Lambda function as stated above (VPC2) – Harsh Vasoya Oct 21 '19 at 06:40

0 Answers0