0

I am unable to connect to AWS Keyspaces using .NET Core due to an authentication error:

AuthenticationException 'Provided username nick and/or password are incorrect')

I am not sure what values I should give to PlainTextAuthProvider.

I have tried using:

  • My AWS Console credentials
  • AWS access key / secret key pair

How do I generate credentials for AWS Keyspaces?


My code, in case it is relevant:

open System
open Cassandra

[<EntryPoint>]
let main argv = 
  async {    
    let cluster =
      Cluster.Builder()
        .AddContactPoints("cassandra.eu-west-2.amazonaws.com")
        .WithPort(9142)
        .WithAuthProvider(PlainTextAuthProvider ("username", "password123"))
        .WithSSL()
        .Build()

    use! session =
      cluster.ConnectAsync ()
      |> Async.AwaitTask

    ()
  }
  |> Async.RunSynchronously

  0
sdgfsdh
  • 33,689
  • 26
  • 132
  • 245

1 Answers1

0

The option is found in the IAM section.

Naviagate to:

  • "Services" drop-down
  • Click "Identity and Access Management (IAM)"
  • Open the "Users" tab
  • Click on You username
  • Open the "Security credentials" tab
  • Scroll to the "Credentials for Amazon Keyspaces" section
  • Click "Generate Credentials"

enter image description here

This will show a pop-up where you can generate credentials.


Additionally, the code should specify a Keyspace:

open System
open Cassandra

[<EntryPoint>]
let main argv = 
  async {    
    let cluster =
      Cluster.Builder()
        .AddContactPoints("cassandra.eu-west-2.amazonaws.com")
        .WithPort(9142)
        .WithAuthProvider(PlainTextAuthProvider ("username", "password123"))
        .WithSSL()
        .Build()

    use! session =
      cluster.ConnectAsync "test_keyspace"
      |> Async.AwaitTask

    ()
  }
  |> Async.RunSynchronously

  0
sdgfsdh
  • 33,689
  • 26
  • 132
  • 245