I am struggling to get my AWS VPC endpoints to work. I've missed something in the setup but cannot work it out.
I have a lambda that is triggered by an SQS entry, the lambda is within a VPC. The lambda is triggered and attempts to write to a different SQS queue.
When the lambda runs it times out attempting to write an SQS queue entry.
I have created a VPC endpoint for 'com.amazonaws.eu-west-2.sqs' (London Region) attached to that VPC. Reading the document it says I have to route traffic through the endpoint, but I have no idea how to do that.
Can anyone help me with what the next steps in setting this up are, or point me in the direction of documentation that provides the step by step approach (for someone who have very little networking knowledge).
To reproduce your situation I did the following (in the London region):
Lambda-SG
) that permits all Outbound trafficLambda-SG
security group with the function:I then invoked the Lambda function by pressing the Test button (and using the default test values) and received the error:
This is expected since the Lambda function is connected to a private subnet that does not have a VPC Endpoint for SQS.
Endpoint-SG
) that permits All inbound traffic fromLambda-SG
(That is, the Inbound rule inEndpoint-SG
specifically referencesLambda-SG
)It worked:
I will admit that, after adding the VPC Endpoint, the function still had a timeout. That's why I used the VPC Reachability Analyzer to test the connection. It said everything should work okay. Then, when I tried the Lambda function again, it worked successfully. So, there might be a delay between adding the VPC Endpoint and having it work correctly.
Hopefully you can compare your setup with the above steps to see what differs. I recommend that you start by examining the Security Group on the Lambda function and the Security Group on the VPC Endpoint. These should be different Security Groups -- one with an Outbound rule and one with an Inbound rule.