Download AWS CloudFormation User Guide

Transcript
AWS CloudFormation User Guide
Resource Attributes
Required: No
Type: Integer
Resource Attribute Reference
This section details the attributes that you can add to a resource to control additional behaviors and
relationships.
Topics
• CreationPolicy Attribute (p. 639)
• DeletionPolicy Attribute (p. 641)
• DependsOn Attribute (p. 642)
• Metadata Attribute (p. 645)
• UpdatePolicy Attribute (p. 645)
CreationPolicy Attribute
You associate the CreationPolicy attribute with a resource to prevent its status from reaching create
complete until AWS CloudFormation receives a specified number of success signals or the timeout period
is exceeded. To signal a resource, you can use the cfn-signal (p. 679) helper script or SignalResource
API. AWS CloudFormation publishes valid signals to the stack events so that you track the number of
signals sent.
The creation policy is invoked only when AWS CloudFormation creates the associated resource. Currently,
the only AWS CloudFormation resources that support creation policies are
AWS::AutoScaling::AutoScalingGroup (p. 288), AWS::EC2::Instance (p. 354), and
AWS::CloudFormation::WaitCondition (p. 326).
The CreationPolicy attribute is helpful when you want to wait on resource configuration actions before
stack creation proceeds. For example, if you install and configure software applications on an Amazon
EC2 instance, you might want those applications up and running before proceeding. In such cases, you
can add a CreationPolicy attribute to the instance and then send a success signal to the instance after
the applications are installed and configured. For a detailed example, see Deploying Applications on
Amazon EC2 with AWS CloudFormation (p. 234).
Syntax
"CreationPolicy" : {
"ResourceSignal (p. 639)" : {
"Count (p. 639)" : Integer,
"Timeout (p. 640)" : String
}
}
ResourceSignal Properties
Count
The number of success signals AWS CloudFormation must receive before it sets the resource status
as CREATE_COMPLETE. If the resource receives a failure signal or doesn't receive the specified
number of signals before the timeout period expires, the resource creation fails and AWS
CloudFormation rolls the stack back.
API Version 2010-05-15
639