Split-Up / Include / Reference serverless.yml file?


#1

Just some short question regarding larger projects:

  • Is it possible to split up the serverless.yml file into several files?
  • Or to “include” other yml files in the main serverless.yml file?
  • Or to reference to other serverless.yml files in subfolders?

#2

The best way to structure a large project is with an API per functionality.

/users
/products
/payments
etc.

You will end up getting long deploy times if you do not structure in this way and you will end up hitting a hard limit of 200 resources per Cloudformation template.

Good luck


#3

@Franky you can reference smaller yaml files with the ${file} variables https://serverless.com/framework/docs/providers/aws/guide/variables/#reference-variables-in-other-files


#4

@DavidWells thanks for the hint, i did overlook this little detail in the docs.