Class CfnStack

All Implemented Interfaces:
IConstruct, IDependable, IInspectable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:29:54.920Z") @Stability(Stable) public class CfnStack extends CfnResource implements IInspectable
A CloudFormation AWS::CloudFormation::Stack.

The AWS::CloudFormation::Stack resource 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* .

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, CloudFormation updates the top-level stack and initiates an update to its nested stacks. CloudFormation updates the resources of modified nested stacks, but doesn't update the resources of unmodified nested stacks. For more information, see CloudFormation stack updates .

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 CloudFormation , see Controlling access with AWS Identity and Access Management .

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.core.*;
 CfnStack cfnStack = CfnStack.Builder.create(this, "MyCfnStack")
         .templateUrl("templateUrl")
         // the properties below are optional
         .notificationArns(List.of("notificationArns"))
         .parameters(Map.of(
                 "parametersKey", "parameters"))
         .tags(List.of(CfnTag.builder()
                 .key("key")
                 .value("value")
                 .build()))
         .timeoutInMinutes(123)
         .build();
 
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnStack

      protected CfnStack(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnStack

      protected CfnStack(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnStack

      @Stability(Stable) public CfnStack(@NotNull Construct scope, @NotNull String id, @NotNull CfnStackProps props)
      Create a new AWS::CloudFormation::Stack.

      Parameters:
      scope -
      • scope in which this resource is defined.
      This parameter is required.
      id -
      • scoped id of the resource.
      This parameter is required.
      props -
      • resource properties.
      This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector -
      • tree inspector to collect and process attributes.
      This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getTags

      @Stability(Stable) @NotNull public TagManager getTags()
      Key-value pairs to associate with this stack.

      AWS CloudFormation also propagates these tags to the resources created in the stack. A maximum number of 50 tags can be specified.

    • getTemplateUrl

      @Stability(Stable) @NotNull public String getTemplateUrl()
      Location of file containing the template body.

      The URL must point to a template (max size: 460,800 bytes) that's located in an Amazon S3 bucket. For more information, see Template anatomy .

      Whether an update causes interruptions depends on the resources that are being updated. An update never causes a nested stack to be replaced.

    • setTemplateUrl

      @Stability(Stable) public void setTemplateUrl(@NotNull String value)
      Location of file containing the template body.

      The URL must point to a template (max size: 460,800 bytes) that's located in an Amazon S3 bucket. For more information, see Template anatomy .

      Whether an update causes interruptions depends on the resources that are being updated. An update never causes a nested stack to be replaced.

    • getNotificationArns

      @Stability(Stable) @Nullable public List<String> getNotificationArns()
      The Amazon Simple Notification Service (Amazon SNS) topic ARNs to publish stack related events.

      You can find your Amazon SNS topic ARNs using the Amazon SNS console or your Command Line Interface (CLI).

    • setNotificationArns

      @Stability(Stable) public void setNotificationArns(@Nullable List<String> value)
      The Amazon Simple Notification Service (Amazon SNS) topic ARNs to publish stack related events.

      You can find your Amazon SNS topic ARNs using the Amazon SNS console or your Command Line Interface (CLI).

    • getParameters

      @Stability(Stable) @Nullable public Object getParameters()
      The set value pairs that represent the parameters passed to CloudFormation when this nested stack is created.

      Each parameter has a name corresponding to a parameter defined in the embedded template and a value representing the value that you want to set for the parameter.

      If you use the Ref function to pass a parameter value to a nested stack, comma-delimited list parameters must be of type String . In other words, you can't pass values that are of type CommaDelimitedList to nested stacks.

      Conditional. Required if the nested stack requires input parameters.

      Whether an update causes interruptions depends on the resources that are being updated. An update never causes a nested stack to be replaced.

    • setParameters

      @Stability(Stable) public void setParameters(@Nullable IResolvable value)
      The set value pairs that represent the parameters passed to CloudFormation when this nested stack is created.

      Each parameter has a name corresponding to a parameter defined in the embedded template and a value representing the value that you want to set for the parameter.

      If you use the Ref function to pass a parameter value to a nested stack, comma-delimited list parameters must be of type String . In other words, you can't pass values that are of type CommaDelimitedList to nested stacks.

      Conditional. Required if the nested stack requires input parameters.

      Whether an update causes interruptions depends on the resources that are being updated. An update never causes a nested stack to be replaced.

    • setParameters

      @Stability(Stable) public void setParameters(@Nullable Map<String,String> value)
      The set value pairs that represent the parameters passed to CloudFormation when this nested stack is created.

      Each parameter has a name corresponding to a parameter defined in the embedded template and a value representing the value that you want to set for the parameter.

      If you use the Ref function to pass a parameter value to a nested stack, comma-delimited list parameters must be of type String . In other words, you can't pass values that are of type CommaDelimitedList to nested stacks.

      Conditional. Required if the nested stack requires input parameters.

      Whether an update causes interruptions depends on the resources that are being updated. An update never causes a nested stack to be replaced.

    • getTimeoutInMinutes

      @Stability(Stable) @Nullable public Number getTimeoutInMinutes()
      The length of time, in minutes, that CloudFormation waits for the nested stack to reach the CREATE_COMPLETE state.

      The default is no timeout. When CloudFormation detects that the nested stack has reached the CREATE_COMPLETE state, it marks the nested stack resource as CREATE_COMPLETE in the parent stack and resumes creating the parent stack. If the timeout period expires before the nested stack reaches CREATE_COMPLETE , CloudFormation marks the nested stack as failed and rolls back both the nested stack and parent stack.

      Updates aren't supported.

    • setTimeoutInMinutes

      @Stability(Stable) public void setTimeoutInMinutes(@Nullable Number value)
      The length of time, in minutes, that CloudFormation waits for the nested stack to reach the CREATE_COMPLETE state.

      The default is no timeout. When CloudFormation detects that the nested stack has reached the CREATE_COMPLETE state, it marks the nested stack resource as CREATE_COMPLETE in the parent stack and resumes creating the parent stack. If the timeout period expires before the nested stack reaches CREATE_COMPLETE , CloudFormation marks the nested stack as failed and rolls back both the nested stack and parent stack.

      Updates aren't supported.