Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

secretshardul avatar image
secretshardul asked Erick Ramirez commented

How do I connect to Astra from VSCode Workbench extension?

The Cassandra workbench extension lets us run CQL queries from within VSCode. It uses a config file of this format for connection:

[
  // AllowAllAuthenticator
  {
    "name": "Cluster AllowAllAuthenticator",
    "contactPoints": [
      "127.0.0.1"
    ]
  },
  //PasswordAuthenticator
  {
    "name": "Cluster PasswordAuthenticator",
    "contactPoints": [
      "127.0.0.1"
    ],
    "authProvider": {
      "class": "PasswordAuthenticator",
      "username": "username",
      "password": "password"
    }
  }
]

I'm able to connect it with a Cassandra server running on localhost. I want to connect it with Astra, how can this be done? I tried replacing the IP address with

https://$ASTRA_DB_ID-$ASTRA_DB_REGION.apps.astra.datastax.com

but it didn't work (environment variables replaced with actual URL).

The Astra documentation mainly talks about Stargate based connections (REST, GraphQL etc). Please help.

astra
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered Erick Ramirez commented

You will need to configure more than just the contact points to be able to connect to DataStax Astra but I don't think the Cassandra workbench supports SSL certificates.

In order to connect to Astra, you need to to download the secure-connect zipped bundle for your Astra database.

Unzip your copy of secure-connect-your_astra_db.zip which will contain the following files:

ca.crt
cert
cert.pfx
config.json
cqlshrc
identity.jks
key
trustStore.jks

The config.json file contains the following:

  • host - the contact point for the CQL driver
  • port - the CQL client port
  • keyspace - the name of the keyspace you created
  • trustStoreLocation - trustStore.jks is the truststore
  • trustStorePassword - your truststore password
  • keyStoreLocation - identity.jks is the keystore
  • keyStorePassword - your keystore password

You'll need to add the keystore/truststore and certificates to your configuration. Cheers!

2 comments Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

@Erick Ramirez thanks for the detailed answer!

0 Likes 0 ·

Glad to help. Cheers!

0 Likes 0 ·