简体   繁体   中英

make sam to IGNORE requirements.txt

So I am using AWS SAM to build and deploy some function to AWS Lambda. Because of my slow connection speed uploading functions is very slow, so I decided to create a Layer with requirements in it. So the next time when I try to deploy function I will not have to upload all 50 mb of requirements, and I can just use already uploaded layer.

Problem is that I could not find any parameter which lets me to just ignore requirements file and just deploy the source code.

Is it even possible?

I hope I understand your question correctly, but if you'd like to deploy a lambda without any dependencies you can try two things:

  • not running sam build before running sam deploy
  • having an empty requirements.txt file. Then sam build simply does not include any dependencies for that lambda function.

Of course here I assume the layer is already present in AWS and is not included in the same template. If they are defined in the same template, you'd have to split them into two stacks. One with the layer which can be deployed once and one with the lambda referencing that layer.

Unfortunately sam build has no flag to ignore requirements.txt as far as I know, since the core purpose of the command is to build dependencies.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM