简体   繁体   中英

Which username and password should I use for Amazon Keyspaces (managed Cassandra)?

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

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"

在此处输入图像描述

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM