3

I'd like to create one larger RDS instance and share it across OpsWorks stacks so I can pool the database resources across multiple applications. Here is a reference to the OpsWorks docs for configuring the data sources for an app:

http://docs.aws.amazon.com/opsworks/latest/userguide/workingapps-creating.html#workingapps-all-app-types

I've tried using the RDS option (under Data Sources) to select an existing RDS instance. However, Opsworks only displays instances that are currently not attached to another Stack.

The only option I can think of is to choose None under Data Sources and then manually configure the deploy JSON for the database settings. One downside to this approach is the hookup is not "automatic" so I'm not sure if any functionality will be lost. Also, I would have to store the database user and password in the Stack JSON which is possibly less secure than the automatic hookup.

Any advice is appreciated.

TomDavies
  • 141
  • 6

1 Answers1

1

Here is the solution I ended up using.

  1. Select "None" for the App Data source type.

  2. Add the following deploy Custom JSON database settings to your Stack Settings for each app:

 
  { 
    "deploy": {
        "YOURAPP": {
          "database": {
            "adapter": "mysql2",
            "host": "HOST",
            "port": "3306",
            "database": "DATABASE",
            "username": "USERNAME",
            "password": "PASSWORD",
            "reconnect": "false"
          }
        }
      }
    }
TomDavies
  • 141
  • 6
  • Hmm I am doing this now, however, when I have booted up an instance in stack `a`, the instances in stack `b` end up not assigning themselves and ip and then end up staying stuck in booting. When I stop the instances in `a` and start up the instances in `b` it works just fine -_- – Paulius Dragunas May 15 '17 at 09:43