title: Time-Based Scaling on Elastic Beanstalk
body: <p>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.</p>
  
  <p>But, when i add a configuration file in the .ebextensions folder which should do the same, the servers don't scale at all.</p>
  
  <p>According to the <a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.managing.as.html#using-features.managing.as.timebased" rel="noreferrer">documentation</a> (search for "<em>Examples of Time-based Scaling Option Settings Files</em>") of Elastic Beanstalk, it is possible to add an .ebextension file with the time-based scaling configuration.</p>
  
  <p>So i adjusted the example and added the according definition to the project:</p>
  
  <p><code>{
    [
      {
        "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"
      }
    ]
  }
  </code></p>
  
  <p>Basically this is copy &amp; 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. </p>
  
  <p>Now the servers should scale down ("OvernightShutdown") to 0 at 9pm UTC and should scale up ("MorningStartup") at 7am UTC.</p>
  
  <p>But the "OvernightShutdown" and the "MorningStartup" are not triggered when they should.</p>
  
  <p>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.</p>
  
  <p>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 <a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.managing.as.html#using-features.managing.as.timebased" rel="noreferrer">documentation</a></p>