Automatically Hibernate your Nutanix Cluster

  • 25 November 2020
  • 1 reply

Userlevel 4
Badge +21
Why a Grizzly bear? Why not?


Awhile ago I created a video showing how you could easily save lots of money by saving dollars on the EC2 costs by using hibernate. Nutanix Clusters is the only on-prem vendor offering this  for customers that want to lift and shift to the public cloud or use the public cloud for DR. I want to share the code snippet and how to create an API user in the Clusters portal.

You can first get familiar with hibernate here:



To create an API user to make the call:

  • Go to the Clusters portal 
  • Under Organization go to users
Go to the user option
  • Create an API user
Add an API user

   You can limit the scope of the user to a single cluster.


Once you have a API user you can use the below script to make an API call or add a script to a VM.

import hashlib
import hmac
import time
import requests
import base64

# Client credentials
#client_id from the user from the clusters portal
client_id = "*********"
#client_secret password from the user on the clusters portal
client_secret = "vvvvvvvf5ff3a3aemmmhhhh1c302"
cluster_id ="1115ac9d-c768-5c71-8e8e-5fzz7b535ec9"
# Create signature
timestamp = int(time.time())
to_sign = "%s%s" % (timestamp, client_id)
signature =, to_sign, hashlib.sha256).hexdigest()
#stage_domain = ""
prod_domain = ""
domain = prod_domain

# Prepare http request headers
headers = { "X-Frame-ClientId": client_id, "X-Frame-Timestamp": str(timestamp), "X-Frame-Signature": signature }

hibernate_req = + "/v1/clusters/" + cluster_id + "/hibernate" , headers=headers)

client_id and client_secret are going to come from the above step of creating an API user.

Once you have that sorted we can create a playbook in Prism Central.

Picking your trigger for your playbook


You can hibernate based off an event/alert or just pick a time that you want it to run. In my example I placed the script on a VM and then call the script.


Creating a playbook in Prism Central 


Hopefully this gets your wheels turning and you can come up with your own creative solutions. 

1 reply

Userlevel 4
Badge +21

For customer that are also looking to resume the cluster via Prism Centeral the Resume API call is 

/api/rest/v1/clusters/{id}/resume_cluster , so use the same call above but replace hibnernate with “resume_cluster”