Managing database access list

You can use the DevOps API to manage your database IP access lists.

To manage database IP access lists, you need the Organization Administrator or Database Administrator role.

Prerequisites

Get IP access lists

Get the existing access lists for your databases.

  • Get all access lists

  • Get one access list

Get the IP access lists for all databases in your organization. For more information, see the API reference.

curl --request GET \
  --url 'https://api.astra.datastax.com/v2/access-lists' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer <application_token>'

Get the IP access list for one database. For more information, see the API reference.

curl --request GET \
  --url 'https://api.astra.datastax.com/v2/databases/<databaseId>/access-list' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer <application_token>'
Response

A successful response includes the IP access list entries for one database or all databases in your organization, depending on the request:

[
  {
    "organizationId": "303a3598-0905-4b5d-9db2-4bf2f9790973",
    "databaseId": "8fbcfe1d-56fa-4ed0-9aff-f57029feef1b",
    "addresses": [
      {
        "address": "137.187.23.0/24",
        "enabled": true,
        "description": "This address allows the database connections from the production environment.",
        "lastUpdateDateTime": "2021-01-21T17:32:28Z"
      }
    ],
    "configurations": {
      "accessListEnabled": true
    }
  }
]

Add access list entries

Each database has its own IP access list. When you add entries, make sure you add them to all applicable databases.

For multi-region databases, all regions share the same access list.

  1. If you have no access list entries, you can get an access list template:

    curl --request GET \
      --url 'https://api.astra.datastax.com/v2/access-list/template' \
      --header 'Accept: application/json' \
      --header 'Authorization: Bearer <application_token>'
Response
[
  {
    "organizationId": "303a3598-0905-4b5d-9db2-4bf2f9790973",
    "databaseId": "8fbcfe1d-56fa-4ed0-9aff-f57029feef1b",
    "addresses": [
      {
        "address": "137.187.23.0/24",
        "enabled": true,
        "description": "This address allows the database connections from the production environment.",
        "lastUpdateDateTime": "2021-01-21T17:32:28Z"
      }
    ],
    "configurations": {
      "accessListEnabled": true
    }
  }
]
  1. Send a POST request to the access-list endpoint with your new access list entries in the request body. For more information, see the API reference.

    curl --request POST \
      --url 'https://api.astra.datastax.com/v2/databases/<databaseId>/access-list' \
      --header 'Accept: application/json' \
      --header 'Authorization: Bearer <application_token>' \
      --data '{
          [
            "address": "125.187.17.0/24",
            "enabled": true,
            "description": "Development"
          ]
        }'
  2. Optional: To verify that the entries were added, use the Get IP access lists endpoints.

  3. After adding IP access list entries, restart any applications, including clients and drivers, that depend on a connection to your database. DataStax recommends testing IP access list changes in a development environment prior to applying them in production.

    It can take a few minutes for a database to honor new IP access list entries. Wait a few minutes before attempting to connect to your database from the new IP address.

Replace or edit an existing access list

  1. Use the Get IP access lists endpoints to get the existing entries for the IP access list that you want to replace.

  2. To replace the entire list, send a PUT request containing the new access list entries:

    curl --request PUT \
      --url 'https://api.astra.datastax.com/v2/databases/<databaseId>/access-list' \
      --header 'Accept: application/json' \
      --header 'Authorization: Bearer <application_token>' \
      --data '{
          "addresses": [
              {
                "address": "125.187.17.0/24",
                "enabled": true,
                "description": "Development"
                "lastUpdateDateTime": "2021-01-21T17:32:28Z"
              }
            ],
            "configurations": {
              "accessListEnabled": true
            }
        }'
  3. To update an entry, send a PATCH request containing the entries to update. The address is the unique identifier for each entry.

    curl --request PATCH \
      --url 'https://api.astra.datastax.com/v2/databases/<databaseId>/access-list' \
      --header 'Accept: application/json' \
      --header 'Authorization: Bearer <application_token>' \
      --data '{
          "addresses": [
              {
                "address": "125.187.17.0/24",
                "enabled": true,
                "description": "Development"
              }
            ],
            "configurations": {
              "accessListEnabled": true
            }
        }'
  4. Optional: To verify the changes, use the Get IP access lists endpoints.

  5. After modifying IP access list entries, restart any applications, including clients and drivers, that depend on a connection to your database. DataStax recommends testing IP access list changes in a development environment prior to applying them in production.

    It can take a few minutes for a database to honor new IP access list entries. Wait a few minutes before attempting to connect to your database from the new IP address.

Delete entries or lists

  1. Use the Get IP access lists endpoints to get the existing entries for the IP access list that you want to edit or delete.

  2. To delete specific addresses, send a DELETE request that includes the specific addresses to delete.

    If you don’t specify an address to delete, the entire access list is deleted. If you delete the entire list, public access is no longer restricted.

    curl --request DELETE \
      --url 'https://api.astra.datastax.com/v2/databases/<databaseId>/access-list' \
      --header 'Accept: application/json' \
      --header 'Authorization: Bearer <application_token>' \
      --data '{
          "addresses": [
              {
                "address": "125.187.17.0/24"
              }
            ]
        }'
  3. To delete a database’s entire access list, send a DELETE request with no body.

    If you delete the entire list, public access is no longer restricted.

    curl --request DELETE \
      --url 'https://api.astra.datastax.com/v2/databases/<databaseId>/access-list' \
      --header 'Accept: application/json' \
      --header 'Authorization: Bearer <application_token>'
  4. Optional: To verify the deletions, use the Get IP access lists endpoints.

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com