简体   繁体   English

通过 SSL 将 Django Postgres 连接到 AWS RDS

[英]Connect Django Postgres to AWS RDS over SSL

I'm digging into Django and thought it would be a nice exercise to connect to an AWS RDS database over SSL, but I can't quite figure out how to provide the SSL-cert from AWS to the database config.我正在研究 Django 并认为通过 SSL 连接到 AWS RDS 数据库将是一个很好的练习,但我不太清楚如何从 AWS 向数据库配置提供 SSL 证书。

I've downloaded the global-bundle.pem from https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL.html .我已经从https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL.ZFC35FDC70D5FC69D2369AZ83下载了global-bundle.pem

Now in the Django source code, it seems you can pass these parameters to DATABASES :现在在 Django 源代码中,您似乎可以将这些参数传递给DATABASES

DATABASES = {
    'default': {
        ...
        'OPTIONS': {
            'sslmode': 'verify-ca',
            'sslrootcert': 'root.crt',
            'sslcert': 'client.crt',
            'sslkey': 'client.key',
        },
    }
}

My question is, how do I convert/pass the certificate from AWS?我的问题是,如何从 AWS 转换/传递证书?

I think you can just do something like我认为你可以做类似的事情

        'OPTIONS': {
            'sslmode': 'verify-full',
            'sslrootcert': 'global-bundle.pem'
        },

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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