With AWS, why can't I just state in the cloudformation template which dependencies I need? Right now I need to add the dependencies automatically in an accompanying script during our gitlab pipeline. It would seem more convenient to do like Google Appengine, and state the dependencies in the top-level template. Here's an example adding dependencies from my google appengine app.yaml, just stating what I need and it seems AWS doesn't have something similar:

- name: webapp2
  version: latest
- name: jinja2
  version: latest

This is a matter of implementation details and it's actually coming from the AWS Lambda product's implementation (which the doc you linked refers to), not from the Cloud Formation itself.

Presently the AWS Lambda implementation requires you to include the actual dependent packages in the deployment package (per the doc you referenced). Hence the CFT doesn't really need a way to specify such dependencies - it'd be useless as it can't be passed to Lambda.

Should Lambda infra end up supporting a way to just list the dependent packages, Cloud Formation might be enhanced to support specifying the list right in the template and passing it somehow to Lambda. But this is just speculation, it all depends on the AWS feature roadmap :)

Side note: the Google App Engine (GAE) example could be seen as a bit questionable as it's specific for just a small subset of that product's capabilities (applicable only to the GAE-supplied libraries for the python 2.7 standard environment). Maybe a better reference would be to the requirements.txt or package.json (or other language-specific) files used to specify external/third party package dependencies for GAE environments, as well as other Google Cloud Platform (GCP) products, including Cloud Functions (CFs) (which would be the GCP product closest matching AWS Lambda). See Specifying dependencies for CFs in Python, NodeJS 6 and NodeJS 8.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.