In this section, we are going to go create a rule from scratch. In the process, you will learn about the three components of a rule.
This rule will help us periodically delete all but the last 30 snapshots matching a Tag Group. Additionally, we will set up a notification to be delivered 30 minutes before the action is scheduled to take place, which will deliver:
There are three components in a rule:
From our glossary:
The Context is the scope of a Rule. A completed Context will specify:
- The target Platform (AWS/Azure)
- The appropriate scope for the selected cloud Platform, either:
- One, many or all AWS Accounts and AWS Regions
- One, many or all Azure Subscriptions
For this Rule, we'll target all AWS Accounts and all AWS Regions.
From our glossary:
The Trigger is the observed event that will cause the Rule to run once.
For our snapshot deletion Rule we wish to delete snapshots daily and receive notifications 30 minutes prior to each execution.
Using the Schedule trigger is a great choice for when you wish to perform work periodically.
Next, we need to select the days of the week, the time at which we want to trigger this rule's execution, and the timezone within which we should interpret the schedule's definition. You can use the searchable list to find your desired timezone (no need to convert to UTC!). Use the weekly time picker to select Every Day.
Next, click on the Offsets link in the side nav.
This is where we can configure the timing of a notification prior to the scheduled execution time. By default notifications are sent to all selected notification destinations 10 minutes before the scheduled time.
Next, click on the Notifications link in the side nav.
In this view you can select destinations for upcoming Schedule notifications. These notifications contain a list of targeted resources and provide a timely opportunity to snooze or cancel the upcoming instance of the recurring schedule.
From our glossary:
An Action is an automation capability specifying how GorillaStack is to interact with targeted cloud resources in response to the observed Trigger. A Rule can support one or many Actions.
As the Rule we are trying to create is intended to clean up old snapshots, we select the Delete Snapshots action.
Now, we need to determine which snapshots we want to delete. In this example, we will target all snapshots for simplicity. However, we can filter snapshots based on their existing tags. This is achieved by using a GorillaStack configuration called a Tag Group. For a user guide on creating your first Tag Group, read a guide on creating a Tag Group.
Next, click on the Snapshot Settings link in the side nav. Here, we specify the snapshot retention policy we wish to apply.