我应该为 Amazon Keyspaces(托管 Cassandra)使用哪个用户名和密码?

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

由于身份验证错误,我无法使用 .NET Core 连接到 AWS Keyspaces:

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

我不确定我应该给 PlainTextAuthProvider 什么值。

我试过使用:

如何为 AWS Keyspaces 生成凭证?


我的代码,如果相关的话:

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

选项位于 IAM 部分

导航至:

  • “服务”下拉菜单
  • 单击“身份和访问管理 (IAM)”
  • 打开“用户”选项卡
  • 点击您的用户名
  • 打开“安全凭据”选项卡
  • 滚动到“Amazon Keyspaces 凭证”部分
  • 单击“生成凭据”

这将显示一个弹出窗口,您可以在其中生成凭据。


此外,代码应指定键空间:

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