dors
(Dors)
July 25, 2023, 11:06am
1
Hello,
I would like to be able to pause/unpause my GCP managed AuraDS instance through a command.
I'm running a daily ETL that uses the instance, so there is no point for me to keep it alive 24/7 if I only need it for 2 hours a day.
I couldn't find any command to do that, the only way I found out is through the UI.
Would appreciate your help
There isn't a way to stop/start the instance besides for in the UI. Cypher commands to do that are not supported in Aura.
but we cant do this with API? i'm trying to do exactly it, but i read something about must have api-role.
Ok, but i want to do this with python. I read something about api-role. Do you know if i have to raise a support ticket to get this role associated to my user?
@infraplataforma
api-role ?
Overview - Neo4j Aura is the top level doc.
and I want to do this with python. I'm not a python hard core developer but Python and REST APIs: Interacting With Web Services – Real Python seems to describe it fairly succinctly as to how to submit REST requests
and for example
import requests, json
from requests.auth import HTTPBasicAuth
# Make the request to the Aura API Auth endpoint
token_response = requests.request(
"POST",
"https://api.neo4j.io/oauth/token",
headers={"Content-Type": "application/x-www-form-urlencoded"},
data={"grant_type": "client_credentials"},
auth=HTTPBasicAuth("<clientID>", "<clientSecret>")
)
response_dict=token_response.json()
access_token=response_dict.get('access_token')
response = requests.request(
"GET",
"https://api.neo4j.io/v1/instances",
headers={"accept": "application/json", "Authorization": "Bearer " + access_token}
)
print(json.dumps(response.json(),indent="\t"))
and when replacing and with their respective values and on line 10 above, i.e. the line with auth=HTTPBasicAuth("<clientID>", "<clientSecret>")
will return the results of Aura API and /instances
finally see Aura CLI - Command Line Interface for Neo4j Aura - Neo4j Labs a labs project and built in python
1 Like
thanks for you support! help me a lot!
1 Like