Table of Contents
SAP HANA Cloud databases are billed based on their usage. When used for development or test purposes, it's often necessary to keep them running only during working hours. SAP Automation Pilot can help reduce your company's costs by ensuring that your databases are only running when they are needed. To find out more about the HANA Cloud's billng costs, please feel free to consult HANA Cloud at SAP Discover Center.
SAP Automation Pilot has the capabilities to perform mass operations on tens or even hundreds of HANA Cloud databases, including stop, start or restart. In addition to this, these operations can be performed regularly with the Scheduled Executions functionality.
This example includes two commands - MassStopHanaCloudInstances and MassStartHanaCloudInstances. They begin by querying all HANA Cloud databases across all Cloud Foundry spaces in your BTP account. After that, these commands would either start or stop each HANA Cloud instance in parallel.
To collect all databases, we utilize the ListServiceInstances command which is part of the SAP Service Manager catalog.
service: hana-cloud
. This is necessary to identity them among other service instances that you might have in your spaces. This logic can easily be changed by modifying the ListHanaCloudInstances step in the example commands. Please also check this documentation page for more information on how to use the filter queries.
To use this example you'll need the following:
- One or more HANA Cloud databases in the Cloud Foundry environment
- Instance of SAP Service Manager with plan subaccount-admin and a service key/binding with default configurations.
- Platform user with Space Developer role in the spaces where the databases reside
Check out the following resources for more information:
- Deploy SAP HANA Cloud
- Create Users and Manage Roles and Privileges
- Creating Service Instances in Other Environments
- Creating Service Bindings in Other Environments
Import the content of examples catalog in your Automation Pilot tenant. The examples includes two commands - MassStopHanaCloudInstances and MassStartHanaCloudInstances. Navigate to any of them and to trigger them.
You'll need to provide values for the following input keys:
- serviceKey - Service Key for SAP Service Manager
- user - Email or ID of your technical user
- password - Password of your technical user
- identityProvider - Optional: origin key of your identity provider. Defaults to sap.ids
As mentioned before, Automation Pilot allows executions to be automatically triggered on regular intervals - hourly, daily, weekly, monthly or yearly. We can create two Scheduled Executions - one to stop all databases after working hours and another to start them up again on the next morning.
ℹ️ Scheduled Executions use the UTC time zone.
Here are the some example schedule configurations:
- MassStopHanaCloudInstances - executed every weekday at 16:30 UTC
- Schedule - Weekly on Monday, Tuesday, Wednesday, Thursday and Friday
- Hours - 16
- Minutes - 30
- MassStartHanaCloudInstances - every weekday at 06:30 UTC
- Schedule - Weekly on Monday, Tuesday, Wednesday, Thursday and Friday
- Hours - 6
- Minutes - 30
Another important aspect is alerting. It's important to receive notifications (in the form of email, slack message, Jira ticket or use any other alerting channel supported) whenever the commands fail. This could be easily achieved with the help of SAP Alert Notification. More information can be found here.