What is a Lambda Group in serverless?

288 views Asked by At

I'm looking into the serverless-plugin-split-stacks plugin of the serverless framework since I've hit the CloudFormation limit of 200 resources. In the Migration Strategies section of its Github page, it says that I have three options:

  • Per Lambda
  • Per Type
  • Per Lambda Group

The first two, I kinda get what they mean (but I'm not %100 sure). My question here is about the last option. What is a lambda group? And how can I group my lambda functions? Is it something done manually or they are grouped automatically?

1

There are 1 answers

0
Eduardo Veras On

Taking a look into the plugin code per-group-function.js

The plugin auto-group based on the nestedStackCount option.

So, as an example, the following serverless.yml:

custom:
  splitStacks:
    perFunction: false
    perType: false
    perGroupFunction: true
    nestedStackCount: 10

Will group into 10 stacks as:

[serverless-plugin-split-stacks]:    - 10NestedStack: 4
[serverless-plugin-split-stacks]:    - 1NestedStack: 3
[serverless-plugin-split-stacks]:    - 2NestedStack: 1
[serverless-plugin-split-stacks]:    - 3NestedStack: 3
[serverless-plugin-split-stacks]:    - 4NestedStack: 8
[serverless-plugin-split-stacks]:    - 5NestedStack: 5
[serverless-plugin-split-stacks]:    - 6NestedStack: 5
[serverless-plugin-split-stacks]:    - 7NestedStack: 3
[serverless-plugin-split-stacks]:    - 8NestedStack: 4
[serverless-plugin-split-stacks]:    - 9NestedStack: 4

Based on the condition on the script, you need to set nestedStackCount equals or greater than 3.