Lambda Times Out When Getting Object from S3
I had the issue where Lambda function launched in private network times out when trying to get object from S3 bucket. Typically, there are two solutions: Use S3 VPC endpoint (either gateway or interface) since it resolves s3 endpoint to private IP. Attach public IP. This is done using NAT Gateway with Elastic IP (EIP). The problem is, in my case, the S3 bucket is in different region, different account, than the Lambda function while the first solution, even though S3 is a global service, the VPC endpoint can't resolve to S3 in different region. In short, the first solution only works when S3 bucket and Lambda function are in the same region. That left us with solution 2 which is more expensive but works. Also I need to make sure that the S3 bucket policy allows cross account access.