Lights Off/On

Follow

The purpose of this page is to provide you with an overview of the built-in Automation Policies in Kion named Lights Off and Lights On (and variants). You will find information on how these policies work as well as instructions on configuring these policies. This page is intended for a Kion administrator or technical user that is configuring and using this feature in the Kion platform.

Purpose

The purpose of these policies is to provide you with an easy means to turn resources on and off in sandbox environments on a schedule. We do not recommend the use of this policy in production environments without sufficient testing.

  • Lights Off - generally means to stop a resource
  • Lights On - generally means to start resources that were previously stopped by Lights Off

We've taken care to ensure that the stop functions performed by these policies are the most meaningful and effective way to stop resources.

Targeting Kion Instances

Care must be taken with this policy if you intend to manage Kion instances. Here are some important safety guidelines:

  • Do not target production instances of Kion using this policy.
    • To protect your production Kion instance from this policy's actions, you can update your database and application stack to add the tag:value set automation-lights-managed:skip.
  • Ensure that you always have an alternate way of accessing the account where Kion is installed if you intend to manage a non-production instance. For example, have your non-production installation account accessible with a CAR in your production instance first. This ensures that you can always access the account and manually recover the actions if necessary.

Default Configurations

By default, the Lights Off policies are configured to run at 8:00pm ET. If used, the Lights On policies are configured to run at 8:00am ET. In either scenario, all supported resources are targeted.

Adjusting Lights On/Off Times

The out of the box scheduled times are just the policy configuration objects. To change these times, follow these steps:

  1. Navigate to Automation > Automation Policies.
  2. In the By Keyword field, filter for “Lights”. This will produce a filtered list of results.
  3. For each result, follow these steps:
    1. Select the more options menu on the right-side of the listing and choose Edit.
    2. Scroll to the Frequency section of the page and adjust the schedule appropriately.
      1. NOTE: We do not recommend using intervals for this policy unless you intend to produce an Enforcement action that continuously repeats a behavior.
    3. Select Continue.
    4. Do not make any changes on the second page and choose Update Automation Policy.

Opt-In vs. Opt-Out Configurations

This set of policies has two overall variants with several policies that represent each variant.

  • Opt-In
    • This set of policies means that only resources tagged with automation-lights:enabled as the tag:value will be included. All others are skipped.
    • You must explicitly tag resources (or opt-in) in order for them to be targeted.
    • This uses a single Automation Policy for both Lights On and Lights Off as only tagged resources are ever targeted by either operation.
  • Opt-Out (default)
    • This set of policies means that only resources tagged with automation-lights-managed:skip as the tag:value will be excluded. All others are targeted.
    • You must explicitly tag resources (or opt-out) in order for them to be skipped.
    • This uses many Automation Policies for Lights Off as resources are untagged and are therefore identified by type and state (for instance, an AWS EC2 resource is evaluated for isRunning state).
      • In addition to stopping a resource, the outcome of a Lights Off operation is a tagged resource.
    • A single Lights On policy is used because only tagged resources are targeted by this operation.

By default, the system ships with the Lights Off/On Opt-Out configuration as the active set of policies used. We do not recommend using this policy on production systems.

Activating

All you need to do to use this policy is activate it by applying the system-provided Cloud Rules to the appropriate scope. The system-provided Cloud Rules for this functionality are titled Lights On and Lights Off.

For hierarchical implementations, you can simply apply this Cloud Rule to the appropriate OU and allow it to be inherited down to Projects and Accounts.

For implementations that do not follow a hierarchy, we recommend labeling target Projects or OUs with a distinct Kion Label and then using Action Plans to apply this Cloud Rule.

NOTE: You must take care in how you target this Cloud Rule. This Cloud Rule can turn off important resources (such as Kion). You should never target this Cloud Rule at a production instance of Kion.

Timing

Under normal performance conditions, scheduled tasks are expected to complete within 1 hour of the originally scheduled time. For this set of policies, this means that resource actions would complete by 9:00pm ET for the default Lights Off timeframe and 9:00am ET for the default Lights On timeframe. This can vary if your Kion system is experiencing poor performance.

It’s also important to note that some resource actions are not fully complete once initiated by Kion. Things like stopping, starting, and deleting resources may take several minutes to actually complete within the Cloud Service Provider.

Outcomes

The outcome of this operation can be found on the individual Automation Policy page under Impacted Resources. Here’s an example of checking the impact on AWS EC2 resources:

  1. Navigate to Automation > Automation Policies.
  2. At the top, select Enabled to quickly see only the active policies.
  3. On the Enabled tab, type “EC2” in the By Keyword field to filter the policies down.
  4. In the list, select the Lights Off - Opt-out - AWS EC2 Instances policy.
  5. On the policy’s details page, select the Impacted Resources tab. This page will display all of the impacted resource information about the modifications made by the policy.

Quick Start Instructions

NOTE: This set of steps will schedule resources to be turned off. Do not use this policy on an account that hosts your production instance of Kion.

If you want to easily get started with these policies, you can follow the steps below:

  1. Navigate to a Project where you’d like to turn off resources on a schedule.
  2. On the Project, select the Automation > Cloud Rules tabs.
  3. On the Cloud Rules tab, select Add Existing Cloud Rule button or the more options menu and choose Add Existing Cloud Rule.
  4. On the dialog that appears, choose Lights Off as the Cloud Rule and then Confirm selection. This will apply the Cloud Rule that contains the multiple policies policies needed for Lights Off.
  5. If you want to also apply Lights On, repeat the same process but apply the Lights On Cloud Rule instead.