java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, ITaggable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-11-22T02:23:58.126Z") @Stability(Stable) public class CfnStack extends CfnResource implements IInspectable, ITaggable
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 . > A subset of AWS::CloudFormation::Stack resource type properties listed below are available to customers using AWS CloudFormation , AWS CDK , and AWS Cloud Control API to configure.

  • NotificationARNs
  • Parameters
  • Tags
  • TemplateURL
  • TimeoutInMinutes

These properties can be configured only when using AWS Cloud Control API . This is because the below properties are set by the parent stack, and thus cannot be configured using AWS CloudFormation or AWS CDK but only AWS Cloud Control API .

  • Capabilities
  • Description
  • DisableRollback
  • EnableTerminationProtection
  • RoleARN
  • StackName
  • StackPolicyBody
  • StackPolicyURL
  • StackStatusReason
  • TemplateBody

Customers that configure AWS::CloudFormation::Stack using AWS CloudFormation and AWS CDK can do so for nesting a CloudFormation stack as a resource in their top-level template.

These read-only properties can be accessed only when using AWS Cloud Control API .

  • ChangeSetId
  • CreationTime
  • LastUpdateTime
  • Outputs
  • ParentId
  • RootId
  • StackId
  • StackStatus

Example:

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

See Also:
  • 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 software.constructs.Construct scope, @NotNull String id, @Nullable CfnStackProps props)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
      props - Resource properties.
    • CfnStack

      @Stability(Stable) public CfnStack(@NotNull software.constructs.Construct scope, @NotNull String id)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). 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.
    • getAttrChangeSetId

      @Stability(Stable) @NotNull public String getAttrChangeSetId()
      Returns the unique ID of the change set.
    • getAttrCreationTime

      @Stability(Stable) @NotNull public String getAttrCreationTime()
      Returns The time at which the stack was created.
    • getAttrLastUpdateTime

      @Stability(Stable) @NotNull public String getAttrLastUpdateTime()
      Returns the time the stack was last updated.

      This will only be returned if the stack has been updated at least once.

    • getAttrOutputs

      @Stability(Stable) @NotNull public IResolvable getAttrOutputs()
      Returns a list of output structures.
    • getAttrParentId

      @Stability(Stable) @NotNull public String getAttrParentId()
      For nested stacks--stacks created as resources for another stack--returns the stack ID of the direct parent of this stack.

      For the first level of nested stacks, the root stack is also the parent stack.

      For more information, see Working with Nested Stacks in the AWS CloudFormation User Guide .

    • getAttrRootId

      @Stability(Stable) @NotNull public String getAttrRootId()
      For nested stacks--stacks created as resources for another stack--returns the stack ID of the top-level stack to which the nested stack ultimately belongs.

      For more information, see Working with Nested Stacks in the AWS CloudFormation User Guide .

    • getAttrStackId

      @Stability(Stable) @NotNull public String getAttrStackId()
      Returns the unique identifier of the stack.
    • getAttrStackStatus

      @Stability(Stable) @NotNull public String getAttrStackStatus()
      Returns a success or failure message associated with the stack status.
    • getCfnProperties

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

      @Stability(Stable) @NotNull public TagManager getTags()
      Tag Manager which manages the tags for this resource.
      Specified by:
      getTags in interface ITaggable
    • getNotificationArns

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

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

      @Stability(Stable) @Nullable public Object getParameters()
      The set value pairs that represent the parameters passed to CloudFormation when this nested stack is created.
    • 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.
    • 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.
    • getTagsRaw

      @Stability(Stable) @Nullable public List<CfnTag> getTagsRaw()
      Key-value pairs to associate with this stack.
    • setTagsRaw

      @Stability(Stable) public void setTagsRaw(@Nullable List<CfnTag> value)
      Key-value pairs to associate with this stack.
    • getTemplateUrl

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

      @Stability(Stable) public void setTemplateUrl(@Nullable String value)
      Location of file containing the template body.
    • 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.
    • 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.