带有AWS RDS错误的Flask-SQLAlchemy SSL连接 [英] Flask-SQLAlchemy ssl-connection with AWS RDS error
问题描述
我正在尝试通过ssl将Flask应用程序mysql连接与AWS RDS连接起来,当我尝试使用此类mysql客户端时,它可以正常工作
mysql -u user -h myrds.rds.amazonaws.com -p --ssl-ca=rds-combined-ca-bundle.pem
我可以登录,但是当我尝试使用烧瓶应用程序
SQLALCHEMY_DATABASE_URI = 'mysql://user:Password@myrds.rds.amazonaws.com.rds.amazonaws.com/miro_dev?ssl_cert=rds-combined-ca-bundle.pem'
它向我发送错误
sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (2026, 'SSL connection error: Unable to get private key')
我能够通过添加
来获得这项工作 ?sslmode=verify-ca&sslrootcert=rds-combined-ca-bundle.pem
连接字符串.
如果您不关心验证rds,则可以更改sslmode的要求.我从此处下载了pem文件.. >
I am trying to connect flask app mysql connection with AWS RDS over ssl , It works when I am try to use mysql client like this
mysql -u user -h myrds.rds.amazonaws.com -p --ssl-ca=rds-combined-ca-bundle.pem
I am able to login but when I am try with flask app
SQLALCHEMY_DATABASE_URI = 'mysql://user:Password@myrds.rds.amazonaws.com.rds.amazonaws.com/miro_dev?ssl_cert=rds-combined-ca-bundle.pem'
it send me error
sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (2026, 'SSL connection error: Unable to get private key')
I was able to get this work by adding
?sslmode=verify-ca&sslrootcert=rds-combined-ca-bundle.pem
to the connection string.
This came from the postgresql docs here along with the aws docs.
You can change the sslmode to require if you do not care about verifying the rds. I downloaded the pem file from here.
这篇关于带有AWS RDS错误的Flask-SQLAlchemy SSL连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!