Configuring sequelize for Amazon RDS SSL connections

Recently I had to deploy a new events platform I've been working on for Mozilla Webmaker on Heroku, and I found it a little tricky to get Amazon RDS's CA certs to play nice with sequelize. This guide from Heroku is a good start, but I figured I'd fill in the missing steps.

This guide assumes you're using:

Steps

  • Download the Amazon RDS CA cert:
curl https://s3.amazonaws.com/rds-downloads/mysql-ssl-ca-cert.pem > ./{{path}}amazon-rds-ca-cert.pem  
  • Add and commit amazon-rds-ca-cert.pem to git
  • Add the following option when initializing sequelize:
var sequelize = new Sequelize(connectionString, {  
  dialectOptions: {
    'SSL_VERIFY_SERVER_CERT': '{{path}}amazon-rds-ca-cert.pem'
  }
});
  • Deploy, you're done