Exclude botocore from zip
batkuip opened this issue · 4 comments
Is your request related to a new offering from AWS?
No - unrelated
Is your request related to a problem? Please describe.
Build package is not excluding botocore (70Mb) which is pre installed on all the lamba servers by default. This turns even the most basic lambda python into 10Mb zip file.
Describe the solution you'd like.
Botocore is excluded by default.
Describe alternatives you've considered.
I could not find an example to remove botocore from the zip. However an easy way of selecting folders to exclude from the zip file may work - but there might be issues with version numbers in the folder name. Not ideal as this would have to be specified for every python lambda.
Can't use separate requirements.txt either because other packages have dependencies on it.
Hi @batkuip !
You can use patterns
to specify what to exclude/include in the package as shown here - https://github.com/terraform-aws-modules/terraform-aws-lambda/blob/master/examples/build-package/main.tf#L131-L135
Since this module is not limited to Python, I'd like not to add assumptions and let users define the package's content.
Makes sense. Anyway to make it globally applied? As It applies to every single python lambda.
Also I couldn't get this to work:
source_path = [{path = "my lambda", pattern=["!botocore/*"]}]
It excludes everything except app.py ?!
Seems I also have to include pip_requirements=true ? source_path = "lambda" does this automatically
So now it's including requirements but botocore is still included in the zip :/
I'm going to lock this issue because it has been closed for 30 days