Home > Enterprise >  Can we use both DynamoDb and VPC to an aws lambda?
Can we use both DynamoDb and VPC to an aws lambda?

Time:01-20

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

CodePudding user response:

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.

CodePudding user response:

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 :

  • 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....

CodePudding user response:

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.

  •  Tags:  
  • Related