Apache 2.0 licensed Astra Cloud Management CLI
Ready for production
- /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/rsds143/astra-cli/main/script/install-astra.sh)"
- astra login
Instead of downloading the binary this trusts that you have docker installed
- make sure docker is installed
- /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/rsds143/astra-cli/main/script/install-astra-docker.sh)"
- astra.sh login
- install homebrew if you have not
brew tap rsds143/rsds && brew install astra-cli
- download a release
- tar zxvf
- cd
- ./astra
- Install Go 1.17
- run
git clone [email protected]:rsds143/astra-cli.git
- run
./scripts/build
orgo build -o ./bin/astra .
- login
- execute commands on your database
After creating a token with rights to use the devops api
astra login --token "changed"
Login information saved
After creating a service account on the Astra page
astra login --id "changed" --name "changed" --secret "changed"
Login information saved
astra login --json '{"clientId":"changed","clientName":"[email protected]","clientSecret":"changed"}'
Login information saved
astra db create -v --keyspace myks --name mydb
............
database 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b created
astra db secBundle 3c577e51-4ff5-4551-86a4-41d475c61822 -d external -l external.zip
file external.zip saved 12072 bytes written
astra db secBundle 3c577e51-4ff5-4551-86a4-41d475c61822 -d internal -l internal.zip
file internal.zip saved 12066 bytes written
astra db secBundle 3c577e51-4ff5-4551-86a4-41d475c61822 -d proxy-internal -l proxy-internal.zip
file proxy-internal.zip saved 348 bytes written
astra db secBundle 3c577e51-4ff5-4551-86a4-41d475c61822 -d proxy-external -l proxy-external.zip
file proxy-external.zip saved 339 bytes written
astra db secBundle 3c577e51-4ff5-4551-86a4-41d475c61822 -o list
external bundle: changed
internal bundle: changed
external proxy: changed
internal proxy: changed
astra db list
name id status
mydb 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b ACTIVE
astra db list -o json
[
{
"id": "2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b",
"orgId": "changed",
"ownerId": "changed",
"info": {
"name": "mydb",
"keyspace": "myks",
"cloudProvider": "GCP",
"tier": "developer",
"capacityUnits": 1,
"region": "us-east1",
"user": "dbuser",
"password": "",
"additionalKeyspaces": null,
"cost": null
},
"creationTime": "2021-02-24T17:23:19Z",
"terminationTime": "0001-01-01T00:00:00Z",
"status": "ACTIVE",
"storage": {
"nodeCount": 1,
"replicationFactor": 1,
"totalStorage": 5,
"usedStorage": 0
},
"availableActions": [
"park",
"getCreds",
"resetPassword",
"terminate",
"addKeyspace",
"removeKeyspace",
"addTable"
],
"message": "",
"studioUrl": "https://2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b-us-east1.studio.astra.datastax.com",
"grafanaUrl": "https://2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b-us-east1.dashboard.astra.datastax.com/d/cloud/dse-cluster-condensed?refresh=30s\u0026orgId=1\u0026kiosk=tv",
"cqlshUrl": "https://2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b-us-east1.apps.astra.datastax.com/cqlsh",
"graphUrl": "",
"dataEndpointUrl": "https://2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b-us-east1.apps.astra.datastax.com/api/rest"
}
]
astra db get 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b
name id status
mydb 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b ACTIVE
astra db get 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b -o json
{
"id": "2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b",
"orgId": "changed",
"ownerId": "changed",
"info": {
"name": "mydb",
"keyspace": "myks",
"cloudProvider": "GCP",
"tier": "developer",
"capacityUnits": 1,
"region": "us-east1",
"user": "dbuser",
"password": "",
"additionalKeyspaces": null,
"cost": null
},
"creationTime": "2021-02-24T17:23:19Z",
"terminationTime": "0001-01-01T00:00:00Z",
"status": "ACTIVE",
"storage": {
"nodeCount": 1,
"replicationFactor": 1,
"totalStorage": 5,
"usedStorage": 0
},
"availableActions": [
"park",
"getCreds",
"resetPassword",
"terminate",
"addKeyspace",
"removeKeyspace",
"addTable"
],
"message": "",
"studioUrl": "https://2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b-us-east1.studio.astra.datastax.com",
"grafanaUrl": "https://2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b-us-east1.dashboard.astra.datastax.com/d/cloud/dse-cluster-condensed?refresh=30s\u0026orgId=1\u0026kiosk=tv",
"cqlshUrl": "https://2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b-us-east1.apps.astra.datastax.com/cqlsh",
"graphUrl": "",
"dataEndpointUrl": "https://2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b-us-east1.apps.astra.datastax.com/api/rest"
}
NOTE: Does not work on serverless
astra db park -v 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b
starting to park database 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b
...........
database 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b parked
NOTE: Does not work on serverless
astra db unpark -v 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b
starting to unpark database 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b
...........
database 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b unparked
astra db delete -v 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b
starting to delete database 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b
database 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b deleted
I did not have a paid account to verify this works, but you can see it succesfully starts the process
astra db resize -v 72c4d35b-1875-495a-b5f1-97329d90b6c5 2
unable to unpark '72c4d35b-1875-495a-b5f1-97329d90b6c5' with error expected status code 2xx but had: 400 error was [map[ID:2.000009e+06 message:resizing is not supported for this database tier]]