簡體   English   中英

Python:AWS Aurora 無服務器數據 API:用戶密碼驗證失敗

[英]Python: AWS Aurora Serverless Data API: password authentication failed for user

我的想法不多了。

我創建了一個啟用了數據 API 的 Aurora Serverless RDS(版本 1)。 I now wish to execute SQL statements against it using the Data API ( https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html )

我使用提供的指南( https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html#data-api.calling:~:text=Calling%20the% 20Data%20API%20from%20a%20Python%20application )

import boto3

session = boto3.Session(region_name="eu-central-1")
rds = session.client("rds-data")
secret = session.client("secretsmanager")

cluster_arn = "arn:aws:rds:eu-central-1:<accountID>:cluster:aurorapostgres"
secret_arn = "arn:aws:secretsmanager:eu-central-1:<accountID>:secret:dbsecret-xNMeQc"

secretvalue = secret.get_secret_value(
    SecretId = secret_arn
)

print(secretvalue)

SQL = "SELECT * FROM pipelinedb.dataset"

res = rds.execute_statement(
    resourceArn = cluster_arn,
    secretArn = secret_arn,
    database = "pipelinedb",
    sql = SQL
)

print(res)

但是我收到錯誤消息: BadRequestException: An error occurred (BadRequestException) when calling the ExecuteStatement operation: FATAL: password authentication failed for user "bjarki"; SQLState: 28P01 BadRequestException: An error occurred (BadRequestException) when calling the ExecuteStatement operation: FATAL: password authentication failed for user "bjarki"; SQLState: 28P01

我已經驗證了以下內容:

我不知道為什么會出現這個錯誤 - 有什么好主意嗎?

試試這個位於AWS 示例代碼庫中的 AWS 教程。 It shows how to use the AWS SDK for Python (Boto3) to create a web application that tracks work items in an Amazon Aurora database and emails reports by using Amazon Simple Email Service (Amazon SES). 此示例使用使用 React.js 構建的前端與 Flask-RESTful Python 后端進行交互。

將 React.js web 應用程序與 AWS 服務集成。

列出、添加和更新 Aurora 表中的項目。

使用 Amazon SES 發送已過濾工作項的 email 報告。

使用隨附的 AWS CloudFormation 腳本部署和管理示例資源。

https://docs.aws.amazon.com/code-library/latest/ug/cross_RDSDataTracker_python_3_topic.html

嘗試運行 CDK 以正確設置數據庫。

一旦你成功地實現了這個例子,你就會得到這個帶有 Python 后端的前端。 在此處輸入圖像描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM