AWS: Cloud Formation: Is it possible to use multiple "DependsOn"?

SG 86 picture SG 86 · Feb 24, 2014 · Viewed 14.1k times · Source

Given i have this example template:

{
    "AWSTemplateFormatVersion" : "2010-09-09",
    "Mappings" : {
        "RegionMap" : {
            "us-west-1" : { "AMI" : "ami-655a0a20" },
            ...
        }
    },
    "Resources" : {
        "Ec2Instance" : {
            "Type" : "AWS::EC2::Instance",
            "Properties" : {
                ...
            },
            "DependsOn" : "myDB"
        },
        "myDB" : {
            "Type" : "AWS::RDS::DBInstance",
            "Properties" : {
               ...
            }
        },
        "myDB2" : {
            "Type" : "AWS::RDS::DBInstance",
            "Properties" : {
               ...
            }
        }
    }
}

Is it possible to specify multiple DependsOn in any way? Would be great to have somethink like:

"DependsOn" : ["myDB", "myDB2"]

Whats the normal way?

Answer

E.J. Brennan picture E.J. Brennan · Feb 24, 2014

Yes,

The DependsOn attribute can take a single string or list of strings.

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-dependson.html

Syntax:

"DependsOn" : [ String, ... ]