Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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?

like image 992
SG 86 Avatar asked Feb 24 '14 11:02

SG 86


People also ask

How many CloudFormation stacks can you have?

AWS CloudFormation now supports increased limits on the default number of stacks allowed per AWS account. The number of stacks that can be created in an account is now 2000 (previously 200). CloudFormation allows you to model, provision and manage cloud resources in a safe, predictable, and scalable manner.

Can CloudFormation deploy to multiple regions?

You can now deploy CloudFormation Stacks concurrently across multiple AWS regions using AWS CloudFormation StackSets. AWS CloudFormation StackSets announces the ability to deploy CloudFormation Stacks to multiple AWS regions in parallel.

How many AWS CloudFormation stacks can a root user create?

For example, by default, you can only launch 2000 CloudFormation stacks per region in your AWS account.


2 Answers

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, ... ]

like image 118
E.J. Brennan Avatar answered Oct 09 '22 01:10

E.J. Brennan


This answer comes up first in Google, so I will include how to do multiple dependson attributes in YAML, which I found in this answer.

AnotherProductionResource:   Type: AWS::CloudFormation::Stack    Condition: ISProduction    DependsOn:    - AResource    - MyProductionResource    Properties:      [...] 
like image 36
Tim Avatar answered Oct 09 '22 01:10

Tim