2

I am working on a AWS lambda in which i want to use DynamoDB and a VPC(Amazon elasticcache for redis). But I was getting time out error when trigger lambda

4
  • 1
    You can use this as reference if you use the NAT Gateway option from Mark B's answer Commented Jan 19, 2022 at 19:06
  • Can you provide the error that you were getting? Commented Jan 20, 2022 at 5:56
  • @AllanChua I am not getting any error simply my lambda is getting 30 seconds timeout. And I don't want to increase my lambda time >30 because We have a 30 seconds limit in API gateway Commented Jan 30, 2022 at 11:05
  • @samirkrishnacholleti, can you share what are you trying to achieve in the lambda? which language of the SDK did you use? Are you using transactions? Commented Jan 30, 2022 at 17:05

2 Answers 2

4

You either need to create a DyanmoDB VPC Endpoint in the VPC, or add a NAT Gateway to the VPC, and only deploy the Lambda function in subnets that have a route to the NAT Gateway.

Sign up to request clarification or add additional context in comments.

Comments

1

Depending on the VPC configuration subnet/Security Group of your lambda,

If your lambda is in a private subnet :

  • If you want a secure internal way, you can pass with VPC endpoint
  • Else if you want to pass with internet, you must have a NAT Gateway.

Check also the security groups/NACLS....

4 Comments

This is not correct for public subnets. See this answer
Thank you @KaustubhKhavnekar, I didn't know the lambda don't have a public ip, I don't understund why ? but I will change my answer based on that, that means when you deploy a default lambda (without vpc config) they deploy it in a private subnet + NAT ?
That is an internal AWS implementation detail, so unless AWS has publicly disclosed it somewhere, we won't know.
perfect ! Thank you

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.