Answers: <p>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. </p>
  
  <p>Presently the AWS Lambda implementation <em>requires</em> 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.</p>
  
  <p>Should Lambda infra end up supporting a way to just list the dependent packages, Cloud Formation <em>might</em> 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 :)</p>
  
  <p>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 <code>requirements.txt</code> or <code>package.json</code> (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 <a href="https://cloud.google.com/functions/docs/concepts/overview" rel="nofollow noreferrer">Cloud Functions (CFs)</a> (which would be the GCP product closest matching AWS Lambda). See <code>Specifying dependencies</code> for CFs in <a href="https://cloud.google.com/functions/docs/concepts/python-runtime#specifying_dependencies" rel="nofollow noreferrer">Python</a>, <a href="https://cloud.google.com/functions/docs/concepts/nodejs-6-runtime#specifying_dependencies" rel="nofollow noreferrer">NodeJS 6</a> and <a href="https://cloud.google.com/functions/docs/concepts/nodejs-8-runtime#specifying_dependencies" rel="nofollow noreferrer">NodeJS 8</a>.</p>
  
Answers: CC BY-SA 4.0
Answers: 2018-10-06T15:43:04.223Z
Answers: 2018-10-06T15:43:04.223Z
Answers: Dan Cornilescu
Body: <p>With <a href="https://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html" rel="nofollow noreferrer">AWS</a>, 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:</p>
  
  <pre><code>libraries:
  - name: webapp2
    version: latest
  - name: jinja2
    version: latest
  </code></pre>
  
Tags: <amazon-web-services><aws-cloudformation>
Title: Where to state CFT dependencies
UserDisplayName: Niklas Rosencrantz
ThreadText: # Where to state CFT dependencies
  
  (Asked by: username_0 on 2018-10-06)
  
  With [AWS](https://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html), 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:
  
  ```
  libraries:
  - name: webapp2
    version: latest
  - name: jinja2
    version: latest
  
  ```
  
  **Tags:** amazon-web-services, aws-cloudformation
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-10-06. Score: 1 | Accepted answer
  
  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)](https://cloud.google.com/functions/docs/concepts/overview) (which would be the GCP product closest matching AWS Lambda). See `Specifying dependencies` for CFs in [Python](https://cloud.google.com/functions/docs/concepts/python-runtime#specifying_dependencies), [NodeJS 6](https://cloud.google.com/functions/docs/concepts/nodejs-6-runtime#specifying_dependencies) and [NodeJS 8](https://cloud.google.com/functions/docs/concepts/nodejs-8-runtime#specifying_dependencies).
  
  
  ---
  
  