Error by Opsworks : unable to find rds instance with ARN

206 views Asked by At

I'm creating an opsworks stack using a cloudformation template, and I have few applications in my stack that require a database RDS instance :

"WordpressApp": {
        "Type": "AWS::OpsWorks::App",
        "Properties": {
         "AppSource" : {
          "Type" : "git",
          "Url" : "git://github.com:myproject/wordpress.git",
          "Revision" : "master"
         },
         "DataSources":[{
          "Arn" : { "Ref" : "RDSInstanceARN" },
          "DatabaseName" : "application",
          "Type" : "RdsDbInstance"
         }],
         "Description": "website application",
         "Name" : "app",
         "Shortname" : "app",
         "StackId" : {"Ref": "MyStack"},
         "Type" : "php"
        }
    },

Here is the RDSInstancARN parameter :

"RDSInstanceARN" : {
    "Description" : "Arn of the RDS instance",
    "Type" : "String",
    "Default" : "arn:aws:rds:eu-west-1:454524154879:db:instanceappdb"
}

The ARN is well written. When I test the template I get this error :

unable to find rds instance with ARN 

What is the cause of this error ? I don't understand, the arn is written properly and it exists in the aws account and running. Any idea please ? Thank you.

1

There are 1 answers

0
wjordan On BEST ANSWER

Have you registered your RDS instance with your OpsWorks stack first?

According to Amazon RDS Service Layer documentation section, the procedure for using an RDS instance with an OpsWorks stack is as follows:

  1. Use the Amazon RDS console, API, or CLI to create an instance. Be sure to record the instance's ID, master user name, master password, and database name.
  2. To add an Amazon RDS layer to your stack, register the Amazon RDS instance with the stack.
  3. Attach the layer to an app, which adds the Amazon RDS instance's connection information to the app's deploy attributes.
  4. Use the language-specific files or the information in the deploy attributes to connect the application to the Amazon RDS instance.

I believe setting the DataSources property on an AWS::OpsWorks::App corresponds to #3 above, but #2 will need to be done first.

Unfortunately it looks like step #2 isn't officially supported by CloudFormation - see my answer to your other question, Create an RDS Opsworks Layer by a Cloudformation template for more details/discussion on that step.