AWS::CloudFormation::Stack
The AWS::CloudFormation::Stack type nests a stack as a resource in a top-level
template.
You can add output values from a nested stack within the containing template. You
use the
GetAtt function with the nested
stack's logical name and the name of the output value in the nested stack in the format
Outputs..
NestedStackOutputName
Important
We strongly recommend that updates to nested stacks are run from the parent stack.
When you apply template changes to update a top-level stack, AWS CloudFormation updates the top-level stack and initiates an update to its nested stacks. AWS CloudFormation updates the resources of modified nested stacks, but does not update the resources of unmodified nested stacks. For more information, see AWS CloudFormation Stacks Updates.
Note
You must acknowledge IAM capabilities for nested stacks that contain IAM resources. Also, verify that you have cancel update stack permissions, which is required if an update rolls back. For more information about IAM and AWS CloudFormation, see Controlling Access with AWS Identity and Access Management.
Syntax
To declare this entity in your AWS CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::CloudFormation::Stack", "Properties" : { "NotificationARNs" : [String, ...], "Parameters" : { AWS CloudFormation Stack Parameters }, "Tags" : [Resource Tag, ...], "TemplateURL" :String, "TimeoutInMinutes" :Integer} }
YAML
Type: AWS::CloudFormation::Stack Properties: NotificationARNs: -StringParameters: AWS CloudFormation Stack Parameters Tags: -Resource TagTemplateURL:StringTimeoutInMinutes:Integer
Properties
NotificationARNs-
A list of existing Amazon SNS topics where notifications about stack events are sent.
Required: No
Type: List of String values
Update requires: No interruption
Parameters-
The set of parameters passed to AWS CloudFormation when this nested stack is created.
Note
If you use the
Reffunction to pass a parameter value to a nested stack, comma-delimited list parameters must be of typeString. In other words, you cannot pass values that are of typeCommaDelimitedListto nested stacks.Required: Conditional (required if the nested stack requires input parameters).
Type: AWS CloudFormation Stack Parameters
Update requires: Whether an update causes interruptions depends on the resources that are being updated. An update never causes a nested stack to be replaced.
Tags-
An arbitrary set of tags (key–value pairs) to describe this stack.
Required: No
Type: Resource Tag
Update requires: No interruption.
TemplateURL-
The URL of a template that specifies the stack that you want to create as a resource. Template files can use any extension, such as
.json,.yaml,.template, or.txt. The template must be stored on an Amazon S3 bucket, so the URL must have the form:https://s3.amazonaws.com/.../TemplateName.extensionRequired: Yes
Type: String
Update requires: Whether an update causes interruptions depends on the resources that are being updated. An update never causes a nested stack to be replaced.
TimeoutInMinutes-
The length of time, in minutes, that AWS CloudFormation waits for the nested stack to reach the
CREATE_COMPLETEstate. The default is no timeout. When AWS CloudFormation detects that the nested stack has reached theCREATE_COMPLETEstate, it marks the nested stack resource asCREATE_COMPLETEin the parent stack and resumes creating the parent stack. If the timeout period expires before the nested stack reachesCREATE_COMPLETE, AWS CloudFormation marks the nested stack as failed and rolls back both the nested stack and parent stack.Required: No
Type: Integer
Update requires: Updates are not supported.
Return Values
Ref
For AWS::CloudFormation::Stack, Ref returns the Stack ID. For
example:
arn:aws:cloudformation:us-east-2:123456789012:stack/mystack-mynestedstack-sggfrhxhum7w/f449b250-b969-11e0-a185-5081d0136786
For more information about using the Ref function, see Ref.
Fn::GetAtt
Outputs.NestedStackOutputName-
Returns: The output value from the specified nested stack where
NestedStackOutputNameis the name of the output value.
For more information about using Fn::GetAtt, see Fn::GetAtt.
Related Information
-
For sample template snippets, see Nested Stacks in AWS CloudFormation Template Snippets.
-
If you have nested stacks that are stuck in an in-progress operation, see Troubleshooting Errors in Troubleshooting AWS CloudFormation.
