Using automatic time-based scaling - AWS OpsWorks

Using automatic time-based scaling

Important

AWS OpsWorks Stacks is no longer accepting new customers. Existing customers will be able to use the OpsWorks console, API, CLI, and CloudFormation resources as normal until May 26, 2024, at which time they will be discontinued. To prepare for this transition, we recommend you transition your stacks to AWS Systems Manager as soon as possible. For more information, see AWS OpsWorks Stacks End of Life FAQs and Migrating your AWS OpsWorks Stacks applications to AWS Systems Manager Application Manager.

Time-based scaling lets you control how many instances a layer should have online at certain times of day or days of the week by starting or stopping instances on a specified schedule. AWS OpsWorks Stacks checks every couple of minutes and starts or stops instances as required. You specify the schedule separately for each instance, as follows:

  • Time of day. You can have more instances running during the day than at night, for example.

  • Day of the week. You can have more instances running on weekdays than weekends, for example.

Note

You cannot specify particular dates.

Adding a time-based instance to a layer

You can either add a new time-based instance to a layer, or use an existing instance.

To add a new time-based instance
  1. On the Instances page, choose + Instance to add an instance. On the New tab, choose Advanced, and then choose time-based.

    
                            Time-based scaling option on Add instance page
  2. Configure the instance. Then choose Add Instance to add the instance to the layer.

To add an existing time-based instance to a layer
  1. On the Time-based Instances page, choose + Instance if a layer already has a time-based instance. Otherwise, choose Add a time-based instance. Then choose the Existing tab.

    
                            Add existing time-based instance to a layer
  2. On the Existing tab, choose an instance from the list. The list shows only time-based instances.

    Note

    If you change your mind about using an existing instance, on the New tab, create a new instance, as described in the preceding procedure.

  3. Choose Add instance to add the instance to the layer.

Configuring a time-based instance

After you add a time-based instance to a layer, you configure its schedule as follows.

To configure a time-based instance
  1. In the navigation pane, under Instances, choose Time-based.

  2. Specify the online periods for each time-based instance by filling the appropriate boxes below the desired hour.

    • To use the same schedule every day, choose the Every day tab, and then specify the online time periods.

    • To use different schedules on different days, choose each day, and then choose the appropriate time periods.

    
                            Schedule for time-based scaling
Note

Be sure to allow for the amount of time it takes to start an instance, and that AWS OpsWorks Stacks checks only every few minutes to see if instances should be started or stopped. For example, if an instance should be running by 1:00 UTC, start it at 0:00 UTC. Otherwise, AWS OpsWorks Stacks might not start the instance until several minutes past 1:00 UTC, and the instance takes several more minutes to be online.

You can change an instance's online time periods at any time by performing the preceding steps. The next time AWS OpsWorks Stacks checks, it uses the new schedule to determine whether to start or stop instances.

Note

You can add a new time-based instance to a layer by opening the Time-based page, and choosing Add a time-based instance (if you have not yet added a time-based instance to the layer) or + Instance (if the layer already has one or more time-based instances). Then, configure the instance as described in the preceding procedures.