- Newest
- Most votes
- Most comments
As you are able to read small objects, this is definitively not a permission issue.
Is your function attached to a VPC? If it does, do you really need it there? If your function does not need to be attached, remove it from the VPC as you will get better network bandwidth.
How much memory did you allocate the function? The higher the memory, the better the network bandwidth.
Even with correct IAM permissions, AWS Lambda functions may experience timeouts when accessing Amazon S3 due to factors beyond authorization. Common causes include networking or VPC configuration issues, inadequate memory or CPU allocation, and inefficient processing of large objects. When a Lambda function is deployed within a VPC, it no longer has default internet access and must be configured with either an S3 VPC endpoint or a NAT gateway to establish connectivity. Without these, S3 requests can stall until the function times out. Additionally, downloading large objects may exceed the function’s ephemeral storage capacity or available memory bandwidth, further contributing to performance issues.
https://docs.aws.amazon.com/lambda/latest/dg/troubleshooting-networking.html
https://docs.aws.amazon.com/lambda/latest/dg/troubleshooting-configuration.html
Lambda is in a VPC and accessing S3 through a NAT Gateway, which is slow for large files. Fix: add an S3 VPC Endpoint, large files are read all at once instead of streaming, which is slow and memory heavy,not enough Lambda resources (CPU). tip: If small files work but large one's timeout, check VPC - S3 access path and switch to streaming reads.
answered a year ago
Relevant content
asked 10 months ago
