AWS re:Post을(를) 사용하면 다음에 동의하게 됩니다. AWS re:Post 이용 약관

Delete a specific file within a Lambda function when cannot use Console Code Editor

0

Hello,

I deployed a package on Lambda, but I received the following error:

deployment package of your Lambda function is too large to enable inline code

I found that an extra, unnecessary file ended up in the exported ZIP package that pushed it over the 3 MB console editor limit as described here: https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html#limits-list

I'd like to delete that single file from the function without having to remake the entire Lambda function from scratch from a new ZIP file, because of the extensive re-configuration and extra validation work on our end that would be needed to do that.

Since I can't access the console editor, however, I cannot simply right click the file and hit Delete like I would normally to delete the file.

So my question is: is it possible to check and delete a specific file within a Lambda function when we cannot use the console editor, either through AWS web API or the CLI?

Thank you for your help.

1개 답변
0

This is not possible and not recommended either. Lambda takes the zip file that you upload and does some processing internally with it. That artifact is not made available to users. So you will need to unzip the zip file, delete that culprit file and recreate the zip file and redeploy to lambda.

Ideally you should be using SAM or CDK or other tools like Terraform for deploying your Lambda functions and integrate them into a CI/CD pipeline.

A good workshop to get hands-on with SAM and AWS CI/CD services is here - https://cicd.serverlessworkshops.io/

profile pictureAWS
전문가
답변함 3년 전
  • Hello Indranil,

    Thank you very much for your help and suggestions!

    If it can't be done, it can't be done - but it's just frustrating because I could easily delete that superfluous file in the console editor with a simple right click -> Delete, were that editor actually available to me.

    But because I just happened to cross an arbitrary 3 MB limit, I have no console editor, so the files that comprise the function seem to be set in stone. Just wish there was a way to capture that same functionality in this case.

    Oh well, thanks anyway, and will check out the resources you mentioned.

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

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

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