{"id":15710284,"url":"https://github.com/aws/aws-sigv4-auth-cassandra-nodejs-driver-plugin","last_synced_at":"2025-10-20T03:32:38.358Z","repository":{"id":42365500,"uuid":"304341116","full_name":"aws/aws-sigv4-auth-cassandra-nodejs-driver-plugin","owner":"aws","description":"A SigV4 authentication client side plugin for the open-source DataStax NodeJS Driver for Apache Cassandra. Allows use of IAM users and roles.","archived":false,"fork":false,"pushed_at":"2023-11-15T10:35:08.000Z","size":33,"stargazers_count":5,"open_issues_count":8,"forks_count":15,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-01-28T19:48:28.682Z","etag":null,"topics":["amazon-keyspaces","aws","aws-sigv4","cassandra","cql","datastax-nodejs-driver","keyspaces","nodejs","sigv4","sigv4client"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aws.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-15T13:49:53.000Z","updated_at":"2024-04-28T21:03:17.000Z","dependencies_parsed_at":"2024-06-19T09:53:50.053Z","dependency_job_id":"5ce5da12-a061-4395-ad6e-ed1dc7d2ed0b","html_url":"https://github.com/aws/aws-sigv4-auth-cassandra-nodejs-driver-plugin","commit_stats":{"total_commits":10,"total_committers":5,"mean_commits":2.0,"dds":0.5,"last_synced_commit":"b72075c8430cb3316a8961a7ef7388a2d9c76062"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws%2Faws-sigv4-auth-cassandra-nodejs-driver-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws%2Faws-sigv4-auth-cassandra-nodejs-driver-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws%2Faws-sigv4-auth-cassandra-nodejs-driver-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws%2Faws-sigv4-auth-cassandra-nodejs-driver-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aws","download_url":"https://codeload.github.com/aws/aws-sigv4-auth-cassandra-nodejs-driver-plugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237261350,"owners_count":19281207,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amazon-keyspaces","aws","aws-sigv4","cassandra","cql","datastax-nodejs-driver","keyspaces","nodejs","sigv4","sigv4client"],"created_at":"2024-10-03T21:05:34.910Z","updated_at":"2025-10-20T03:32:31.749Z","avatar_url":"https://github.com/aws.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# IMPORTANT: Latest Version\n\nThe current version is 1.0.5. Please see the [changelog](./CHANGELOG.md) for details on version history.\n\n# What\n\nThis package implements an authentication plugin for the open-source Datastax NodeJS Driver for Apache Cassandra. The driver enables you to add authentication information to your API requests using the AWS Signature Version 4 Process (SigV4). Using the plugin, you can provide users and applications short-term credentials to access Amazon Keyspaces (for Apache Cassandra) using AWS Identity and Access Management (IAM) users and roles.\n\nThe plugin depends on the AWS SDK for NodeJS. It uses `AWSCredentialsProvider` to obtain credentials. You must specify the service endpoint to use for the connection.\nYou can provide the Region in the constructor programmatically, via the `AWS_REGION` environment variable.\n\nThe full documentation for the plugin is available at\n[Amazon Keyspaces AWS Docs](https://docs.aws.amazon.com/keyspaces/latest/devguide/programmatic.credentials.html#programmatic.credentials.SigV4_KEYSPACES).\n\n\n# Using the Plugin\n\nThe following sections describe how to use the authentication plugin for the open-source DataStax NodeJS Driver for Cassandra to access Amazon Keyspaces.\n\n## SSL Configuration\n\nThe first step is to get an Amazon digital certificate to encrypt your connections using Transport Layer Security (TLS). The DataStax NodeJS driver must use an SSL trust store so that the client SSL engine can validate the Amazon Keyspaces certificate on connection. To use the trust store and create a certificate, see [Using a Cassandra Java Client Driver to Access Amazon Keyspaces Programmatically](https://docs.aws.amazon.com/keyspaces/latest/devguide/programmatic.drivers.html#using_java_driver).\n\n## Region Configuration\n\nBefore you can start using the plugin, you must configure the AWS Region that the plugin will use when authenticating. This is required because SigV4 signatures are Region-specific. For example, if you are connecting to the `cassandra.us-east-2.amazonaws.com` endpoint, the Region must be `us-east-2`. For a list of available AWS Regions and endpoints, see [Service Endpoints for Amazon Keyspaces](https://docs.aws.amazon.com/keyspaces/latest/devguide/programmatic.endpoints.html).\n\nYou can specify the Region using one of the following four methods:\n\n* Environment Variable\n* System Property\n* Constructor\n* Configuration\n\n## Environment Variable\n\nYou can use the `AWS_REGION` environment variable to match the endpoint that you are communicating with by setting it as part of your application start-up, as follows.\n\n``` shell\n$ export AWS_Region=us-east-1\n```\n\n## Add the Authentication Plugin to the Application\n\nThe authentication plugin supports version 4.x of the DataStax NodeJS Driver for Cassandra. To add this application use \n\n```bash\n$ npm install aws-sigv4-auth-cassandra-plugin --save\n```\n\n## How to use the Authentication Plugin\n\nWhen using the open-source DataStax NodeJS driver, the connection to your Amazon Keyspaces endpoint is represented by the `Client` class. \n\n### Programmatically Configure the Driver\n\nWhen using the DataStax NodeJS driver, you interact with Amazon Keyspaces primarily through the `Client` class.\n\nTo use the authentication plugin, you set a Region-specific instance of SigV4AuthProvider as the authentication provider, as in the following example.\n\n1. Create a `SigV4AuthProvider` from plugin.\n1. Add an SSL context using `AmazonRootCA1.pem` ssl and Keyspaces endpoint. \n1. Set the local data center to the region name, in this example it is `us-west-2`. \nThe local data center is used by the driver for routing of requests, and it is required when the builder is constructed with `addContactPoints`.\n1. Set the authentication provider to a new instance of the `SigV4AuthProvider`.\nYou can specify the Region for the endpoints that you’re using in the constructor for `SigV4AuthProvider`, as in the following example. \nOr, you can set the environment variable or system property as shown previously.\n\nThe following code example demonstrates the previous steps.\n\n``` js\nconst cassandra = require('cassandra-driver');\nconst fs = require('fs');\nconst sigV4 = require('aws-sigv4-auth-cassandra-plugin');\n\nconst auth = new sigV4.SigV4AuthProvider({\n    region: 'us-west-2', \n    accessKeyId:'AKIAIOSFODNN7EXAMPLE',\n    secretAccessKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'});\n\nconst sslOptions1 = {\n  ca: [\n      fs.readFileSync('~/.cassandra/AmazonRootCA1.pem', 'utf-8')],\n  host: 'cassandra.us-west-2.amazonaws.com',\n  rejectUnauthorized: true\n};\n\n\nconst client = new cassandra.Client({\n  contactPoints: ['cassandra.us-west-2.amazonaws.com'],\n  localDataCenter: 'us-west-2',\n  authProvider: auth,\n  sslOptions: sslOptions1,\n  protocolOptions: { port: 9142 }\n});\n\n\nconst query = 'SELECT * FROM system_schema.keyspaces';\n\nclient.execute(query).then(\n    result =\u003e console.log('Row from Keyspaces %s', result.rows[0]))\n    .catch( e=\u003e console.log(`${e}`));\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faws%2Faws-sigv4-auth-cassandra-nodejs-driver-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faws%2Faws-sigv4-auth-cassandra-nodejs-driver-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faws%2Faws-sigv4-auth-cassandra-nodejs-driver-plugin/lists"}