Uploading 2.43gb CSV file to S3 Bucket using python Lambda 'Calling the invoke API action failed with this message: Network Failure'

0

Getting the error 'Calling the invoke API action failed with this message: Network Failure' when uploading a 2.43gb CSV file to S3 Bucket using python Lambda. I've set resources to max, timeout to 5 mins, smaller files it works fine but when I try to do a large file of 2.43gb it gives me that error. Funnily enough despite the error the file still appears in the bucket, but the fact it's throwing an error is annoying me..

JWFB
질문됨 10달 전278회 조회
1개 답변
0

If your lambda function is within VPC, then check the subnet security group and make sure it allows outbound traffic to all.

However to communicate with s3 within VPC also, internet is not required and lambda function can directly communicate with S3 via s3 gateway VPC endpoint.

On AWS Console, choose VPC service and then Endpoints. Create a new endpoint, associate it to s3 service. -> Select VPC and Route Table.

Here is the detailed instruction document for same, see section Create a gateway endpoint in this document.

Hope you find this useful.

Abhishek

profile pictureAWS
전문가
답변함 10달 전
  • Thanks for coming back to me - I'm not using a VPC, the lambda function downloads a zip from a website into the temp folder, unpacks the zip into a temp folder which gives me the csv file, the csv file is then uploaded to my bucket. I have maxed out the memory allocation/timeouts. Weirdly enough the file does appear in the s3 bucket but when testing the function gets the error network failure.

    When I test the same process but with a smaller zip/csv file, the function works with no errors, so it seems to be some sort of size issue - having said that the csv file when extracted is only 2.4 gbs so still within the max configuration limits of lambda

  • How are you trying to upload file, direct upload or through streaming(reading chunks of data from s3 file). Would you mind mentioning the API/SDK method here or code snippet. From your description it's clear that it has something to do with size/multipart. This error most likely would come if you'll be using s3.upload_file or s3.put_object, you should rather do it with s3.upload_part or upload_part_copy. See the synopsis and example at here.

  • Were you able to resolve the issue?

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠