I'm developing an AWS Serverless architecture.
I have a lambda attached to a subnet within a VPC. I have setup a VPC endpoint to reach my DynamoDB table.
When my lambda is cold, it takes up to 200 - 300ms make a simple GetItem
command to my dynamodb table. This is just the GetItem
command, I have already substracted lambda initialization, DynamoDB client instanciation etc. This is unacceptable for my application.
However, when my lambda is hot, I only take ~8-9msm for the GetItem
command, which is acceptable.
Is there some ENIs latencies because my lambda is attached to a subnet ? If so, what can I do to speed it up ? Or is there another problem that I do not see ?