Skip to content

Schedules

In this section, you will update the "environment template" to use a schedule. The schedule will control when an environment will be executed (i.e created or destroyed automatically). You will implement the steps described below

  1. You will first update the existing environment template and add a schedule to the template.
  2. You will then launch the template and view the actions kick off based on the configured schedule.

Step 1: Create Schedule

In this step, you will update the existing environment template used in the Introductory Exercise by adding a schedule to the template. The schedule will be configured to destroy the environment after a preset amount of time.

  • In your project, navigate to Environments -> Environment Templates
  • Click on the name of the environment template
  • Edit the template
  • Navigate to Schedules
  • Click + Schedule
  • Enter a name for the schedule
  • Select One-time for the Frequency Type
  • Enter 5 for the Time to live field
  • Select Destroy for the Action Type
  • Click Save

Configure Schedule

  • Click Save as Draft

Configure Schedule


Step 2: Create Environment

In this step, we will create a new environment using the recently updated environment template. The environment will be created and then automatically be destroyed after a predefined amount of time.

  • In your project, navigate to Environments -> Environments
  • Click Launch on the environment template card
  • Enter a name for the environment
  • Enter a value for the username variable
  • Click Save & Deploy

Environment

As the environment is being created, you can see countdown to the next scheduled action.

Environment

Once the scheduled time is reached, the schedule will automatically take action to destroy the environment.

Environment

  • Click View All Runs

You will see the initial deployment as well as the automated scheduled destroy of the environment.

Environment


Recap

In this part, you attached a schedule to your environment template. The schedule was configured to automatically destroy the environment after a predefined amount of time. In the next part, we will extend and build on this by attaching a hook that will allow us to insert custom logic into our template.