{"id":15710411,"url":"https://github.com/aws/aws-sigv4-auth-cassandra-gocql-driver-plugin","last_synced_at":"2025-10-20T03:32:55.077Z","repository":{"id":42567213,"uuid":"304078211","full_name":"aws/aws-sigv4-auth-cassandra-gocql-driver-plugin","owner":"aws","description":"A SigV4 authentication plugin for the open-source Gocql Driver for Apache Cassandra. Allows use of IAM users and roles","archived":false,"fork":false,"pushed_at":"2024-01-10T00:52:52.000Z","size":52,"stargazers_count":15,"open_issues_count":1,"forks_count":6,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-01-28T19:48:28.698Z","etag":null,"topics":["amazon-keyspaces","aws","aws-sigv4","cassandra","cql","gocql","gocql-driver","keyspaces","sigv4","sigv4client"],"latest_commit_sha":null,"homepage":"","language":"Go","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-14T16:47:47.000Z","updated_at":"2024-09-01T10:28:44.000Z","dependencies_parsed_at":"2024-01-10T03:44:24.138Z","dependency_job_id":null,"html_url":"https://github.com/aws/aws-sigv4-auth-cassandra-gocql-driver-plugin","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws%2Faws-sigv4-auth-cassandra-gocql-driver-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws%2Faws-sigv4-auth-cassandra-gocql-driver-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws%2Faws-sigv4-auth-cassandra-gocql-driver-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws%2Faws-sigv4-auth-cassandra-gocql-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-gocql-driver-plugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237261468,"owners_count":19281239,"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","gocql","gocql-driver","keyspaces","sigv4","sigv4client"],"created_at":"2024-10-03T21:07:19.845Z","updated_at":"2025-10-20T03:32:45.067Z","avatar_url":"https://github.com/aws.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# IMPORTANT: Latest Version\n\nThe current version is 1.0.0. 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 [Gocql Driver](https://github.com/gocql/gocql) 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 Go. It uses the default credential provider chain to obtain credentials.\n\nYou must specify the service endpoint to use for the connection. You can provide the region as a function argument programmatically or via the `AWS_DEFAULT_REGION` environment variable.\n\nThe full documentation for the plugin is available at AWS Docs:\n[Creating Credentials to Access Amazon Keyspaces](https://docs.aws.amazon.com/keyspaces/latest/devguide/programmatic.credentials.html#programmatic.credentials.SigV4_KEYSPACES)\n\n# Using the Plugin\nThe following sections describe how to use the authentication plugin for the open-source gocql Driver for Cassandra to access Amazon Keyspaces.\n\nTo install the plugin:\n```bash\n$ go get github.com/aws/aws-sigv4-auth-cassandra-gocql-driver-plugin\n```\n\n## SSL Configuration\n\nAmazon Keyspaces requires the use of Transport Layer Security (TLS) to help secure connections with clients. To connect to Amazon Keyspaces using TLS, you need to download an Amazon digital certificate and configure the Go driver to use TLS.\n\nDownload the Starfield digital certificate using the following command and save sf-class2-root.crt locally or in your home directory.\n\n```\ncurl https://certs.secureserver.net/repository/sf-class2-root.crt -O\n```\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* Configuration\n* Function Argument\n\n### Environment Variable\nYou can use the `AWS_DEFAULT_REGION` environment variable to match the endpoint that you are communicating with by setting it as part of your application start-up.\nIf `AWS_DEFAULT_REGION` environment variable is not set, falls back to the `AWS_REGION` environment variable.\n```\n$ export AWS_DEFAULT_REGION=us-east-1\n```\n\n### Function Argument\n\nOne of the functions takes a String representing the Region as an argument, that will be used for that instance.\n\n```go\nfunc NewAwsAuthenticatorWithRegion(region string) AwsAuthenticator {\n\n}\n```\n\n## How to use the Authentication Plugin\n\nWhen using the open-source gocql driver, the connection to your Amazon Keyspaces endpoint is represented by the `Cluster` class.\nSimply use AwsAuthenticator for the authenticator property of the cluster.\n\nHere is a simple example of use:\n\n```go\npackage main\n\nimport (\n        \"fmt\"\n        \"github.com/aws/aws-sigv4-auth-cassandra-gocql-driver-plugin/sigv4\"\n        \"github.com/gocql/gocql\"\n        \"log\"\n)\n\nfunc main() {\n\t// configuring the cluster options\n\tcluster := gocql.NewCluster(\"cassandra.us-west-2.amazonaws.com:9142\")\n\tvar auth sigv4.AwsAuthenticator = sigv4.NewAwsAuthenticator()\n\tauth.Region = \"us-west-2\"\n\tauth.AccessKeyId = \"AKIAIOSFODNN7EXAMPLE\"\n\tauth.SecretAccessKey = \"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY\" \n\n\tcluster.Authenticator = auth\n\n\tcluster.SslOpts = \u0026gocql.SslOptions{\n\t\tCaPath: \"/Users/user1/.cassandra/AmazonRootCA1.pem\",\n\t}\n\tcluster.Consistency = gocql.LocalQuorum\n\tcluster.DisableInitialHostLookup = true\n\n\tsession, err := cluster.CreateSession()\n\tif err != nil {\n\t\tfmt.Println(\"err\u003e\", err)\n\t\treturn\n\t}\n\tdefer session.Close()\n\n\t// doing the query\n\tvar text string\n\titer := session.Query(\"SELECT keyspace_name FROM system_schema.tables;\").Iter()\n\tfor iter.Scan(\u0026text) {\n\t\tfmt.Println(\"keyspace_name:\", text)\n\t}\n\tif err := iter.Close(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}\n```\n\nWhen using AwsAuthenticator from an AWS Lambda function, the Lambda runtimes will initialize all the needed environment variables.\nAll you need to do is assign the authenticator.\n\n```go\n\tcluster.Authenticator = sigv4.NewAwsAuthenticator()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faws%2Faws-sigv4-auth-cassandra-gocql-driver-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faws%2Faws-sigv4-auth-cassandra-gocql-driver-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faws%2Faws-sigv4-auth-cassandra-gocql-driver-plugin/lists"}