Structure of serverless.yml

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:

1 Like

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

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?

1 Like

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

1 Like

Super! Thanks for the help

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
1 Like