1

I have a lambda function that executes every 30 seconds (step function make 2 lambda calls with 30 sec timeout every minute). It reads some data (about 90 items) from dynamodb. And sometimes it throws me ConnectTimeoutError and I can't udenrstand why (today lambda was throwing me this errors for 3 hours every 30 seconds and than it start work correctly again)

Table have On demand capacity. Lambda runtime: python3.8

How can I solve this problem?

2
  • Do you have the Lambda function configured to run in a VPC? Commented Feb 24, 2021 at 20:52
  • @MarkB Yes, It runs in a VPC Commented Feb 24, 2021 at 20:55

1 Answer 1

5

Some of the VPC subnets you have your Lambda function configured to use either don't have a route to a NAT Gateway, or a route to a DynamoDB VPC Endpoint. Each subnet it runs in will need one of those two routes defined.

Note that if the Lambda function doesn't actually need to access anything in the VPC, it would work better without the VPC configuration.

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

2 Comments

Thank you. It worked, ConnectionTimeout to dynamodb is gone. But now, for some reason starts fails (not very frequently) requests to another web resource (not aws related), but maybe problems on their side
If it's running in a VPC, and also needs access to external resources on the Internet, make sure the Lambda function is ONLY deploying in subnets with a route to a NAT Gateway.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.