I try to shutdown/startup my elastic beanstalk (test) environments over night to save ressources when the servers are not needed. On the web console of EB i can enter time-based scalings which are triggered.
But, when i add a configuration file in the .ebextensions folder which should do the same, the servers don't scale at all.
According to the documentation (search for "Examples of Time-based Scaling Option Settings Files") of Elastic Beanstalk, it is possible to add an .ebextension file with the time-based scaling configuration.
So i adjusted the example and added the according definition to the project:
{
[
{
"Namespace": "aws:autoscaling:scheduledaction",
"ResourceName": "OvernightShutdown",
"OptionName": "MinSize",
"Value": "0"
},
{
"Namespace": "aws:autoscaling:scheduledaction",
"ResourceName": "OvernightShutdown",
"OptionName": "MaxSize",
"Value": "0"
},
{
"Namespace": "aws:autoscaling:scheduledaction",
"ResourceName": "OvernightShutdown",
"OptionName": "DesiredCapacity",
"Value": "0"
},
{
"Namespace": "aws:autoscaling:scheduledaction",
"ResourceName": "OvernightShutdown",
"OptionName": "StartTime",
"Value": "2015-11-18T16:50:00Z"
},
{
"Namespace": "aws:autoscaling:scheduledaction",
"ResourceName": "OvernightShutdown",
"OptionName": "Recurrence",
"Value": "00 21 * * 1-5"
},
{
"Namespace": "aws:autoscaling:scheduledaction",
"ResourceName": "MorningStartup",
"OptionName": "MinSize",
"Value": "1"
},
{
"Namespace": "aws:autoscaling:scheduledaction",
"ResourceName": "MorningStartup",
"OptionName": "MaxSize",
"Value": "1"
},
{
"Namespace": "aws:autoscaling:scheduledaction",
"ResourceName": "MorningStartup",
"OptionName": "DesiredCapacity",
"Value": "1"
},
{
"Namespace": "aws:autoscaling:scheduledaction",
"ResourceName": "MorningStartup",
"OptionName": "StartTime",
"Value": "2015-11-19T05:00:00Z"
},
{
"Namespace": "aws:autoscaling:scheduledaction",
"ResourceName": "MorningStartup",
"OptionName": "Recurrence",
"Value": "00 07 * * 1-5"
}
]
}
Basically this is copy & pasted and slightly adjusted according to my needs. I put it in the .ebxtensions/autoscaling.config file in my project and deployed it to EB.
Now the servers should scale down ("OvernightShutdown") to 0 at 9pm UTC and should scale up ("MorningStartup") at 7am UTC.
But the "OvernightShutdown" and the "MorningStartup" are not triggered when they should.
I also had once a typo in the file, then EB told me that it can't parse it, so i know that i reads the file, but obviously it doens't apply the configurations to the environment.
Someone has a clue what could be the problem with this? Is my configuration wrong? Since there are not much examples out there, how the file could look like i have no proper references except the one from the EB documentation
I think you may be suffering from the precedence clauses: configuration options precedence. This caught me out the other day. If you have manually configured the values through the web interface then your config file won't replace those values.
To fix this I:
.ebextensions
config file as you have, made sure it was deployed and ready in the environment.eb config
to bring up the current configuration (this should show the old config)This triggers an environment refresh as if you had changed it in the web interface.
or as @mbaird said in the comments, 0 may not be a valid min and max value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With