...

/

Further Sections of 'template​.yaml'

Further Sections of 'template​.yaml'

In this lesson, you'll see some further sections from 'template.yaml' and learn what they represent.

Description #

After the transformation comes the template description:

Description: >
  sam-app

  Sample SAM Template for sam-app

The Description section contains a free-form explanation of the template. This section is useful if you want to publish the template or give it to another team, but it isn’t necessary. You can safely skip it when creating templates for small experiments.

Multi-line text in YAML #

YAML files usually contain text values on the same line as the corresponding key. You can use the right angle bracket (>) or a pipe (|) to signal that what follows is multi-line text, indented one level. The difference is that > removes line breaks from the result, and | preserves line breaks.

Global application settings #

After the description, the example SAM template contains global application settings. This is a SAM-specific extension to CloudFormation and enables you to reduce the overall template file size by listing common settings in a single place instead of repeating them for each Lambda function. The example template contains just a single function, so adding global values doesn’t make a lot of difference, but this section is useful for more complex applications. The sample template usually contains a global Timeout setting, the number of seconds the function is allowed to run in Lambda:

 ...