简体   繁体   中英

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.

I've downloaded the global-bundle.pem from https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL.html .

Now in the Django source code, it seems you can pass these parameters to 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?

I think you can just do something like

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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