Objectives In this step we will
- Create token
- Create database
- Create Credentials
- Verify Credentials
✅ Create an application token with the Database Administrator role to access Astra DB. Skip this step if you already have a token.
- Sign in (or sign up) to your Astra account at astra.datastax.com
- Create an application token with the Database Administrator role by following these instructions
✅ Setup Astra CLI by providing the Database Administrator application token you created here:
astra setup
✅ Create database workshops
and keyspace library
if they do not exist:
astra db create workshops -k library --if-not-exist --wait
This operation may take a bit longer when creating a new database or resuming an existing hibernated database.
✅ Verify that database workshops
is ACTIVE
and keyspace library
exists:
astra db get workshops
If the command fails, please revisit the previous steps to make sure that the database exists and is ACTIVE
, and retry connecting to the database again.
astra db create-dotenv -k library workshops
Now let's copy those credentials to our environment
python assets/set-environment.py .env workshops
Make a call to the API using httpie to make sure your credentials are working:
http --auth-type astra -a workshops: :/rest/v1/keyspaces
We've actually got an httpie config file so we can skip the auth-type stuff.
Try the simpler call to make sure it works:
http :/rest/v1/keyspaces
Show me the CQL
astra db cqlsh workshops -k library -e "desc keyspaces;"
Great, it's time to dive deeper into the Stargate APIs to see what they can do for you.