Enable autoscaling only for one environment
dbeja opened this issue · comments
Hi,
Is it possible to enable autoscaling only for prod?
What would be the best way to achieve that?
Thanks!
Great idea! The plugin does not support anything like this currently, but maybe you can somehow do this with Reference Variables in Javascript Files
Thanks!
The way I did this was to keep the autoscaling for all environments but with lower values to all environments except prod:
custom:
maxRead_prod: 2000
maxWrite_prod: 1000
capacities:
- table: users
read:
minimum: 5
maximum: ${self:custom.maxRead_${self:provider.stage}, '10'}
write:
minimum: 5
maximum: ${self:custom.maxRead_${self:provider.stage}, '10'}
Hi,
just wanted to do the same thing but for me the nested variable replacement did not work (I got null in the generated template) so I had to write
maximum: ${self.custom.maxRead_prod}
Any idea why?
Do you have the stage defined on provider with a custom value?
provider:
name: aws
runtime: nodejs6.10
stage: ${opt:stage, 'dev'}
Ok, I was using serverless 1.18.0, I updated to 1.24.1 and now it works.
Just stumbled upon this and would like to point out that @dbeja is using the maxRead_
custom variable for both reads and writes. His serverless.yml
file should contain the following.
custom:
maxRead_prod: 2000
maxWrite_prod: 1000
capacities:
- table: users
read:
minimum: 5
maximum: ${self:custom.maxRead_${self:provider.stage}, '10'}
write:
minimum: 5
maximum: ${self:custom.maxWrite_${self:provider.stage}, '10'}