问题
I'm trying to deploy a serverless yaml file that does not fit into a single CloudFormation stack. Searching online, it seems there are plugins for that. So far, I've tested serverless-plugin-split-stacks
. It works but...
I managed to deploy my project which includes more than 200 CloudFormation resources (I couldn't do this without the aforementioned plugin). It's just that, I need to use the serverless-aws-alias
plugin as well. Previously, without the serverless-plugin-split-stacks
plugin, I was deploying my project and the serverless-aws-alias
plugin was creating the aliases for me without any issues.
But now (after adding serverless-plugin-split-stacks
plugin), the lambda function are created has with no aliases. I looked into the CloudFormation stack list and I can see the stack for the alias but still not alias is actually created for the lambda.
I was wondering if anyone has actually managed to deploy a serverless function with more than one stack while using the serverless-aws-alias
plugin!?
[UPDATE]
Here's a simple test case:
service: serverless-test
provider:
name: aws
runtime: nodejs12.x
endpointType: REGIONAL
plugins:
- serverless-plugin-split-stacks
- serverless-aws-alias
custom:
splitStacks:
nestedStackCount: 20
perFunction: false
perType: false
perGroupFunction: true
functions:
create:
handler: code.get
events:
- http:
path: /
integration: lambda
method: get
cors: true
If you deploy this serverless.yml
file like this:
sls deploy --region us-east-1 --stage dev --alais dev
The lambda functions created won't have any aliases (as they should). And these are the version of the packages I use:
$ sls -v
Framework Core: 1.61.2
Plugin: 3.6.6
SDK: 2.3.0
Components Core: 1.1.2
Components CLI: 1.4.0
$ cat ./package.json
{
"name": "serverless-test",
"version": "1.0.0",
"description": "",
"main": "code.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"serverless-aws-alias": "^1.8.0",
"serverless-plugin-split-stacks": "^1.9.3"
}
}
来源:https://stackoverflow.com/questions/61280210/how-to-deploy-a-serverless-project-bigger-than-one-cloudformation-stack-while-la