Structure of serverless.yml


#1

I haven’t found a discussion of the structure of serverless.yml - what must come first, secone, …; what’s required; variable scope; is a variable defined at bottom of file known at top?

All that kind of stuff - I’m hoping someone will tell me to #RTFM, with a link to the M :wink:


#2

You can go through this document first. https://serverless.com/framework/docs/providers/aws/guide/serverless.yml/


#3

Bill,

Thanks, but that’s simply a menu of what’s available - it has no syntax or structure information.

I’ve done some looking at what’s generated by the CloudFormation designer and it appears there’s no structure - just throw the pieces in, as long as the inside of each piece is properly structured (and even there, it doesn’t appear to have any order requirements, only that the necessary attributes are included - True? Not True?


#4

Mostly true.

Some resources need be ordering by DependsOn , mostly needn’t.

Cloudformation (serverless framework in fact generates cloudformation tempaltes) will take care of the ordering how to create these resources, if it can’t handler properly, you need add DependsOn


#5

Super! Thanks for the help


#6

It’s a YAML file. So:

foo:
   ...
bar:
   ...

creates a dict/hash/object with “foo” and “bar” as the keys. Dicts are unordered, so it doesn’t matter whether foo or bar comes first.

Ordering only matters when there’s a list:

life:
  - birth
  - taxes
  - death