11 Surefire Ways To Reduce Your EC2 Costs
14 Jan 2021AWS Config vs CloudTrail
29 Jan 2021In the past few months at GorillaStack, our focus has been on improving support for the Azure platform. Adding to the list of recent announcements for new Azure features, we are excited to release three new Actions in our Rules Engine to manage the lifecycle of Azure SQL Databases. These will help users further reduce their cloud spend.
Azure SQL Databases are charged at an hourly rate while they are provisioned, even while they are stopped. In order to reduce Azure spend, they will need to be deleted.
Export Azure SQL Databases
The Export Azure SQL Databases export Action gives users the ability to export an SQL Database as a .bacpac
file to be stored in Azure Blob Storage. It also supports a “Wait for Export” option to allow synchronous execution when used in a sequence with other Actions. When the “Wait for Export” option is enabled, you can also specify a maximum wait time. If the maximum wait time is reached before confirmation of the export success, the Action will be marked as failed.
By default, all created .bacpac
files will be retained in Azure Blob Storage indefinitely. This behavior can be overridden by disabling the “Retain all exports” option. This will cause the Action to delete any old .bacpac
files for the targeted database, retaining only the most recent export.
Delete Azure SQL Databases
The Delete Azure SQL Databases Action will delete SQL Databases, and supports resource targeting by tags or by name. While there are some niche cases when this Action may be useful on its own. We expect it to be used in a sequence with the Export SQL Databases Action.
Utilizing the wait option on the export Action ensures that the export operation completes successfully before the database is deleted.
Restore Azure SQL Databases
The Restore Azure SQL Databases Action will create a new SQL Database and import a stored .bacpac
file to it. The .bacpac
file used to restore a database must have been created by the GorillaStack Export SQL Databases Action.
Similar to the export Action, it supports a “Wait for import” option to allow synchronous execution when used in a sequence with other Actions.
When To Reduce Azure Spend
The ideal candidates for using these three new Actions to reduce spend on Azure SQL Databases are:
- In non-production environments
- For internal tooling that does not necessitate 24/7 uptime
When paired with a Schedule type trigger, these Actions enable databases to be deleted temporarily when they are not needed (e.g. outside of office hours), and fully restored once more as necessary.
With the wait parameter enabled on the export Action, a Rule with an Action sequence of “Export Azure SQL Databases” -> “Delete Azure SQL Databases” will ensure the export operation has successfully completed before continuing with database deletion.
Action Setup
The export and restore Actions will require some additional setup compared to our existing Rules Engine Actions. The underlying methods used to execute these Actions require admin credentials to the databases being affected.
For security reasons, we will not store these credentials within GorillaStack. To work around this limitation, the export and restore Actions will invoke an Azure Function in the targeted Azure subscription where the admin credentials will be stored in Azure Key Vault. This way the database admin credentials will never be read outside of your own Azure account.
To make the Action setup as seamless as possible, we provide a setup script to be run once per database being targeted. This script can be run either in PowerShell or Azure Cloud Shell, and will create all the required resources for the Actions to be performed.
You can test drive this feature by signing up here.
For a more in-depth explanation of this setup and the resources that will be created, check out the documentation for the new Actions.