I am trying to figure out how to deploy my aws lambdas. They are not related, so I would like each one packaged and deployed individually, along with it’s resources. The only way I figured out to do this so far is by giving each function folder it’s own serverless.yml file. But… in order to keep it DRY, I have one master template config.yml that I am reading the service and provider from.
The problem is, it doesn’t work… sls deploy -v (with debug var on) doesn’t show me any errors, it just stops after “Excluding development dependencies…”
It creates the zip file, but it doesn’t go any further.
It seems to me that the provider gets set up before the file object gets interpolated, something like that, is there any way around this?
This is the folder structure
lambda
config.yml
func1
serverless.yml
index.js
package.json
node_modules
the relevant part of func1/serverless.yml looks like this:
provider: ${file(…/config.yml):provider}
and config.yml looks like this
provider:
[quote=“estyh, post:1, topic:3821, full:true”]
I am trying to figure out how to deploy my aws lambdas. They are not related, so I would like each one packaged and deployed individually, along with it’s resources. The only way I figured out to do this so far is by giving each function folder it’s own serverless.yml file. But… in order to keep it DRY, I have one master template config.yml that I am reading the service and provider from.
The problem is, it doesn’t work… sls deploy -v (with debug var on) doesn’t show me any errors, it just stops after “Excluding development dependencies…”
It creates the zip file, but it doesn’t go any further.
It seems to me that the provider gets set up before the file object gets interpolated, something like that, is there any way around this?
This is the folder structure
lambda
config.yml
func1
serverless.yml
index.js
package.json
node_modules
the relevant part of func1/serverless.yml looks like this:
provider: ${file(…/config.yml):provider}
and config.yml looks like this
provider:
name: aws
runtime: nodejs6.10
memorySize: 512
timeout: 300
region: us-east-1
stage: dev
This is what I saw was happening, with package: individually set to true - for each function, a zip was created that had ALL the js files and all dependencies.
If I set exclude to everything, and then for each function, just included the specific files I needed in the package, then the zip files just included what was necessary - great.
BUT - there is no way to deploy them individually. Yes, there is sls deploy function - but that just swaps out the zip file - as soon as you want to change some configuration for a function (environment variable, event schedule, etc) then you need to run a regular deploy - which deploys EVERYTHING and takes quite a bit of time.
That’s why I thought I need separate serverless.yml files for each function. The functions aren’t related, they don’t need to share a cloudformation stack, they aren’t interacting with different api’s… the only thing they share is all the provider info.