{"id":21022,"library":"cassandra-sigv4","title":"Cassandra SigV4 Auth Plugin","description":"Implements a SigV4 authentication plugin for the open-source DataStax Python Driver for Apache Cassandra, enabling connections to Amazon Keyspaces or other Cassandra clusters that require IAM-based authentication. Current version 4.0.2, release cadence is intermittent.","status":"active","version":"4.0.2","language":"python","source_language":"en","source_url":"https://github.com/aws/aws-sigv4-auth-cassandra-python-driver-plugin/","tags":["cassandra","aws","authentication","sigv4","keyspaces"],"install":[{"cmd":"pip install cassandra-sigv4","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Required runtime dependency: this plugin is an authentication provider for the DataStax Python driver.","package":"cassandra-driver","optional":false},{"reason":"Used to obtain AWS credentials and region. Required unless custom credentials are provided.","package":"boto3","optional":true}],"imports":[{"note":"In older versions the symbol was at package level, but since 4.0.0 it moved to a submodule. The old import will raise ImportError.","wrong":"from cassandra_sigv4 import SigV4AuthProvider","symbol":"SigV4AuthProvider","correct":"from cassandra_sigv4.auth import SigV4AuthProvider"},{"note":"","wrong":null,"symbol":"boto3","correct":"import boto3"}],"quickstart":{"code":"import boto3\nfrom cassandra.cluster import Cluster\nfrom cassandra_sigv4.auth import SigV4AuthProvider\n\n# AWS credentials (region is required; credentials from env or boto3 session)\nboto_session = boto3.Session()\nauth_provider = SigV4AuthProvider(boto_session=boto_session)\n\ncluster = Cluster(\n    ['cassandra.<region>.amazonaws.com'],\n    port=9142,\n    ssl_context=True,\n    auth_provider=auth_provider\n)\nsession = cluster.connect()\nrow = session.execute('SELECT keyspace_name FROM system_schema.keyspaces').one()\nprint(row)  # Expected: first keyspace\nsession.shutdown()\ncluster.shutdown()","lang":"python","description":"Connects to Amazon Keyspaces using SigV4 authentication. Ensure AWS credentials are available via environment, IAM role, or boto3 session."},"warnings":[{"fix":"Set auth_provider in Cluster(...) call, not after.","message":"The auth_provider must be passed to the Cluster constructor, not set via session or after connection.","severity":"gotcha","affected_versions":"All"},{"fix":"Update imports to from cassandra_sigv4.auth import SigV4AuthProvider.","message":"In version 4.0.0, the import path changed. The class SigV4AuthProvider is no longer importable from the top-level package; use from cassandra_sigv4.auth import SigV4AuthProvider.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Use Python 3.6+ and ensure cassandra-driver version is compatible.","message":"The plugin requires Python 2.7 or 3.x (requires_python >=2.7, <4). It has been tested primarily with Python 3.6+. Older Python 2.7 usage may have compatibility issues with newer versions of cassandra-driver.","severity":"gotcha","affected_versions":"All"},{"fix":"Set AWS_DEFAULT_REGION or pass a boto3 session with explicit region.","message":"The region must be set either via boto3 session, environment variable AWS_DEFAULT_REGION, or the keyspace endpoint hostname. Missing region will cause authentication failure.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Set ssl_context=True and port=9142 in Cluster constructor.","cause":"SSL context not enabled or incorrect port. Amazon Keyspaces requires SSL on port 9142.","error":"cassandra.cluster.NoHostAvailable: ('Unable to connect to any servers', {'<host>:9142': ConnectionException('Failed to connect')})"},{"fix":"Use 'from cassandra_sigv4.auth import SigV4AuthProvider' instead of 'from cassandra_sigv4 import SigV4AuthProvider'.","cause":"Import path changed in version 4.0.0. The class moved to a submodule.","error":"AttributeError: module 'cassandra_sigv4' has no attribute 'SigV4AuthProvider'"},{"fix":"Pass a boto3.Session object: SigV4AuthProvider(boto_session=boto3.Session())","cause":"SigV4AuthProvider requires boto_session or other parameters (like credentials) in newer versions.","error":"TypeError: __init__() missing 1 required keyword-only argument: 'boto_session'"},{"fix":"Set AWS_DEFAULT_REGION environment variable, or create boto3 session with region_name='us-east-1'.","cause":"No AWS region configured. The plugin needs a region from environment, boto session, or hostname.","error":"boto3.exceptions.NoRegionError: You must specify a region."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}