Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
kevin_hu
Active Participant
0 Kudos

For developers working in btp trial and free tier accounts, easilest way to operate and bring up the SAP HANA Cloud instance after the overnight shutdown is by using command lines. Certainly the operations can be done via visual HANA Cloud tools such as HANA central, however command lines opens up potential for automating these processes with managable parameters settings, especially in a production environment. 

This blog is summarizing some common operations using command lines.

**Note: Cloud Foundry CLI can only be used to manage hana cloud service instances created in the cloud foundry runtime environment.

Check my other blog for managing instances in other environments.
Manage SAP HANA Cloud instance on BTP using BTP CLI

Prerequisite

  • Cloud Foundry CLI is installed or you can use the terminal in Business Application Studio
  • Cloud Foundry Environment enabled in your BTP subaccount
  • Entitlement of HANA Cloud is added to the subaccount.
  • Login using cf login

Create an SAP HANA Cloud instance (Cloud Foundry Runtime Environment)

To create a new HANA Cloud instance (in free tier for example) named test-db with offering "hana-cloud" and plans "hana-free". 
For BTP trial environment, choose "hana-cloud-trial" as the offering and "hana" as the plans.
Bash/Shell:

 

 

 

 

 

cf create-service hana-cloud hana-free test-db -c '{"data":{"edition":"cloud","memory":32,"systempassword":"Welcome100."}}'

 

 

 

 

 

use cf services to check the progress of the creation and watch for a create succeeded tag.

Start/Stop an instance

To stop:
Bash/Shell:

 

 

 

 

 

cf update-service test-db -c '{"data":{"serviceStopped":true}}'

 

 

 

 

 

To start:
Bash/Shell:

 

 

 

 

 

cf update-service test-db -c '{"data":{"serviceStopped":false}}'

 

 

 

 

 

Windows Command Line:

 

 

 

 

 

cf update-service test-db -c "{\"data\":{\"serviceStopped\":false}}"

 

 

 

 

 

Powershell:

 

 

 

 

 

cf update-service test-db -c '{\"data\":{\"serviceStopped\":false}}'

 

 

 

 

 

Update whitelisted IPs

For local/hybrid or cross-region developers, whitelisted IPs are needed to be updated on the instance level for connections.

To open connections from all IPs.
Bash/Shell:

 

 

 

 

 

cf update-service test-db -c '{"data":{"whitelistIPs":["0.0.0.0/0"]}}'

 

 

 

 

 

Update parameters from a config file

Fetch the existing parameters into a file

Bash/Shell:

 

 

 

 

 

cf service test-db --params > params.json

 

 

 

 

 

Then format to, including the parameter value to be updated.

 

 

 

 

 

{
  "data": {
    "whitelistIPs": ["0.0.0.0/0"]
  }
}

 

 

 

 

 

Update parameters from a config file

Bash/Shell:

 

 

 

 

 

cf update-service test-db -c params.json

 

 

 

 

 

Full list of parameters can be found here.

Delete an instance

Bash/Shell:

 

 

 

 

 

cf delete-service test-db

 

 

 

 

 

Limitations:

Labels in this area