Yanay Lehavi
Yanay Lehavi

Reputation: 249

AWS SAM: remove basic libs from deployment?

Using SAM and Docker, on my laptop, I built a python lambda application with a function that uses libs requests and pymysql. After SAM deployment, the function in AWS's Lambda includes copies of these libs (and their dependencies libs). It seems they are being read from my requirements.txt file (SAM won't test locally without it.)

My requests.txt does not specify versions. It looks simply like this:

requests
pymysql

I rewrote the same exact function directly in the console (no SAM) and that lambda does not have the libs. Both versions of the function run the same. I'm bothered by those libs showing on the function generated by SAM. My questions:

  1. Do I need to worry about this?
  2. Can I tweak the SAM toml/yaml such that it won't deploy copies of those libs?

For clarity, I recognize that certain libs (e.g. pandas) need to be included in the function or its layers. I'm specifically asking about the "usual suspects" like requests which, I imagine, are in the python runtime anyway. Thank you

Upvotes: 0

Views: 20

Answers (0)

Related Questions