Connecting Ghost to MySQL AWS RDS Instance


Amazon's RDS service (Managed Relational Database Service) allows you to create and host a database in the Amazon cloud rather than having a local one on your server. This article will walk you through how to create an RDS instance and connect Ghost to it.

  1. In your AWS account select the RDS service
  2. Click on the "Launch a DB Instance" to start the creation of a new RDS instance
    Connect Ghost to AWS RDS Instance - Launch a DB Instance In EC2 Region
  3. Select MySQL
    Connect Ghost to AWS RDS Instance - Select MySQL
  4. Select whether you want your RDS instance to be Multi-AZ and have provisioned IOPS
    Connect Ghost to AWS RDS Instance - Development v Production RDS
  5. On the DB Instance Details page change the following settings:

    • DB Instance Class - See the AWS documentation for details on different [RDS Instance Classes](http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html)
    • Multi-AZ Deployment - - See the AWS documentation for details on [RDS Multi-AZ](http://aws.amazon.com/rds/multi-az/)
    • Allocated Storage - If running a personal blog the minimum of 5GB will be a fine start
    • DB Instance Identifier - I have set mine as "ghost", whatever you set it to will have to be set in the Ghost config.js file.
    • Master Username - I have set mine as "ghost", whatever you set it to will have to be set in the Ghost config.js file.
    • Master Password - I have created a unique password for my database user, whatever you set it to will have to be set in the Ghost config.js file.

    Connect Ghost to AWS RDS Instance - RDS DB Instance Details

  6. Name your database - I called mine ghost

    Connect Ghost to AWS RDS Instance - RDS Additional Config

  7. On the Management Options step I would recommend selecting Enabled Automatic Backups

    Connect Ghost to AWS RDS Instance - RDS Management Options

  8. On the Review page click on "Launch DB Instance"
  9. The creation of the DB instance will take a few minutes. Click on the "Close" button and you can watch the status of your instance
  10. One your DB instance has a status of Created, click on the instance so get the details of the instance.
  11. In the instance details section grab the Endpoint URL.
  12. SSH into your AMI and vi into your Ghost config.js (/var/www/ghost if you are using our AMI) file swap out the database connection information with the following snippet:

    database: { 
        client: 'mysql', 
        connection: { 
            host: 'localhost', 
            user: 'database-user', 
            password: 'database-user-password', 
            database: 'database-name', 
            charset: 'utf8' 
        }, 
        debug: false 
    },
    


    • For host fill in your RDS Endpoint URL
    • For user fill in the username you selected in step 5
    • For password fill in the password you selected in step 5
    • For database fill in the database you selected in step 6

    Connect Ghost to AWS RDS Instance - RDS Instance Details

  13. Restart Ghost and your new MySQL RDS instance will be populated with all required tables for Ghost.