繁体   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