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
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.
Depending on the VPC configuration subnet/Security Group of your lambda,
If your lambda are in a public subnet, they can access to DynamoDB.
If your lambda is in a private subnet:
Check also the security groups/NACLS....
When you connect a function to a VPC, Lambda assigns your function to a Hyperplane ENI (elastic network interface) for each subnet in your function's VPC configuration.
Refer to link for more details - https://docs.aws.amazon.com/lambda/latest/dg/configuration-vpc.html
Consider taking 2 lambdas, one lambda to handle Dynamodb logic and another lambda is to communicate with VPC. And invoke the second lambda from the first lambda.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.