scyllapy icon indicating copy to clipboard operation
scyllapy copied to clipboard

[Feature request]: Handle AWS SigV4AuthProvider

Open QuentinRichard-weezevent opened this issue 8 months ago • 3 comments

Hello,

We are using scyllapy on our stack because of its asyncio complete integration. However, we deploy our application on an AWS stack with AWS Keyspace. Following the official AWS documentation it seems, we have two solutions for Cassandra authentication:

As it is, scyllapy does not seem to integrate auth_provider feature and this would be a great improvement in AWS integration.

Do you plan to integrate it in the future?

thanks!

Actually scyllapy supports connecting to AWS keyspaces already. Because we were using it with keyspaces.

The scylla class has parameters ssl_cert, ssl_key, ssl_ca_file and ssl_verify_mode.

To connect it to AWS keyspaces please initialize it as this:

import asyncio

from scyllapy import Scylla
from pathlib import Path


async def main():
    cert = Path("sf-class2-root.crt").read_text()
    scylla = Scylla(
        ["cassandra.eu-central-1.amazonaws.com:9142"],
        username="Your given username",
        password="Your secret key",
        ssl_cert=cert,
    )
    await scylla.startup()

    rows = await scylla.execute("SELECT * FROM system.local")
    for row in rows.all():
        print(row)


if __name__ == "__main__":
    asyncio.run(main())

To download the certificate please follow this guide.

https://docs.aws.amazon.com/keyspaces/latest/devguide/using_python_driver.html

s3rius avatar Apr 01 '25 22:04 s3rius

Thanks for your answer! It will be really helpful to implement in our current stack :) However, the idea would be to avoid basic username / password authentication but using AWS IAM instead.

I see now. Yes, this thing is not yet possible. We might try implementing it after we update the whole library. Because currently it needs a lot of rewrite since underlying scylla driver has been updated to first stable version.

s3rius avatar Apr 04 '25 13:04 s3rius