Lambda function times out after 3 seconds calling an external API. What's wrong?
BeginnerScenarioECS, EKS, Lambda and ECR
Answer
Situation read → Default timeout is 3 seconds, or the function is in a VPC without egress.
What I'd do →
- Increase timeout:
aws lambda update-function-configuration --function-name f --timeout 30 - If VPC-attached, ensure NAT or endpoint access
- Check logs for the exact duration with REPORT lines
- Set client timeouts shorter than the function timeout
Why → VPC-attached Lambdas have no internet unless routed via NAT.
Interview tip → Most "mystery timeouts" are VPC egress.
More on ECS, EKS, Lambda and ECR
ECS on Fargate or on EC2: how do you choose?BeginnerDeploy a containerized API on ECS behind an ALB. What are the building blocks?BeginnerAn ECS service deployment is stuck, tasks start and stop repeatedly. How do you debug?IntermediateRoll out a new ECS service version with canary and automatic rollback.IntermediateEKS pods need access to S3 without node-level permissions. How?IntermediateUpgrade an EKS cluster from 1.31 to 1.33 safely.Intermediate