Show / Hide Table of Contents

Class NestedStack

A CloudFormation nested stack.

Inheritance
object
Stack
NestedStack
KubectlProvider
Implements
ITaggable
Inherited Members
Stack.IsStack(object)
Stack.Of(IConstruct)
Stack.AddDependency(Stack, string)
Stack.AddMetadata(string, object)
Stack.AddStackTag(string, string)
Stack.AddTransform(string)
Stack.AllocateLogicalId(CfnElement)
Stack.ExportStringListValue(object, IExportValueOptions)
Stack.ExportValue(object, IExportValueOptions)
Stack.FormatArn(IArnComponents)
Stack.GetLogicalId(CfnElement)
Stack.RegionalFact(string, string)
Stack.RemoveStackTag(string)
Stack.RenameLogicalId(string, string)
Stack.ReportMissingContextKey(IMissingContext)
Stack.Resolve(object)
Stack.SplitArn(string, ArnFormat)
Stack.ToJsonString(object, double?)
Stack.ToYamlString(object)
Stack.Account
Stack.ArtifactId
Stack.AvailabilityZones
Stack.Dependencies
Stack.Env
Stack.Environment
Stack.Nested
Stack.NotificationArns
Stack.Partition
Stack.Region
Stack.Synthesizer
Stack.Tags
Stack.TemplateOptions
Stack.UrlSuffix
Stack.NestedStackParent
Stack.TerminationProtection
Namespace: Amazon.CDK
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class NestedStack : Stack, ITaggable
Syntax (vb)
Public Class NestedStack Inherits Stack Implements ITaggable
Remarks

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 does not update the resources of unmodified nested stacks.

Furthermore, this stack will not be treated as an independent deployment artifact (won't be listed in "cdk list" or deployable through "cdk deploy"), but rather only synthesized as a template and uploaded as an asset to S3.

Cross references of resource attributes between the parent stack and the nested stack will automatically be translated to stack parameters and outputs.

ExampleMetadata: infused

Examples
using Amazon.CDK;
             using Amazon.CDK.CustomResources;
             using Amazon.CDK.AWS.S3.Deployment;


             var app = new App();
             var stack = new Stack(app, "Stack");
             CustomResourceConfig.Of(app).AddLogRetentionLifetime(RetentionDays.TEN_YEARS);

             var nestedStackA = new NestedStack(stack, "NestedStackA");
             var websiteBucketA = new Bucket(nestedStackA, "WebsiteBucketA", new BucketProps { });
             new BucketDeployment(nestedStackA, "s3deployA", new BucketDeploymentProps {
                 Sources = new [] { Source.JsonData("file.json", new Dictionary<string, string> { { "a", "b" } }) },
                 DestinationBucket = websiteBucketA,
                 LogRetention = RetentionDays.ONE_DAY
             });

             var nestedStackB = new NestedStack(stack, "NestedStackB");
             var websiteBucketB = new Bucket(nestedStackB, "WebsiteBucketB", new BucketProps { });
             new BucketDeployment(nestedStackB, "s3deployB", new BucketDeploymentProps {
                 Sources = new [] { Source.JsonData("file.json", new Dictionary<string, string> { { "a", "b" } }) },
                 DestinationBucket = websiteBucketB,
                 LogRetention = RetentionDays.ONE_DAY
             });

Synopsis

Constructors

NestedStack(Construct, string, INestedStackProps?)

A CloudFormation nested stack.

Properties

BundlingRequired

Indicates whether the stack requires bundling or not.

NestedStackResource

If this is a nested stack, this represents its AWS::CloudFormation::Stack resource.

StackId

An attribute that represents the ID of the stack.

StackName

An attribute that represents the name of the nested stack.

TemplateFile

The name of the CloudFormation template file emitted to the output directory during synthesis.

Methods

IsNestedStack(object)

Checks if x is an object of type NestedStack.

SetParameter(string, string)

Assign a value to one of the nested stack parameters.

Constructors

NestedStack(Construct, string, INestedStackProps?)

A CloudFormation nested stack.

public NestedStack(Construct scope, string id, INestedStackProps? props = null)
Parameters
scope Construct
id string
props INestedStackProps
Remarks

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 does not update the resources of unmodified nested stacks.

Furthermore, this stack will not be treated as an independent deployment artifact (won't be listed in "cdk list" or deployable through "cdk deploy"), but rather only synthesized as a template and uploaded as an asset to S3.

Cross references of resource attributes between the parent stack and the nested stack will automatically be translated to stack parameters and outputs.

ExampleMetadata: infused

Examples
using Amazon.CDK;
             using Amazon.CDK.CustomResources;
             using Amazon.CDK.AWS.S3.Deployment;


             var app = new App();
             var stack = new Stack(app, "Stack");
             CustomResourceConfig.Of(app).AddLogRetentionLifetime(RetentionDays.TEN_YEARS);

             var nestedStackA = new NestedStack(stack, "NestedStackA");
             var websiteBucketA = new Bucket(nestedStackA, "WebsiteBucketA", new BucketProps { });
             new BucketDeployment(nestedStackA, "s3deployA", new BucketDeploymentProps {
                 Sources = new [] { Source.JsonData("file.json", new Dictionary<string, string> { { "a", "b" } }) },
                 DestinationBucket = websiteBucketA,
                 LogRetention = RetentionDays.ONE_DAY
             });

             var nestedStackB = new NestedStack(stack, "NestedStackB");
             var websiteBucketB = new Bucket(nestedStackB, "WebsiteBucketB", new BucketProps { });
             new BucketDeployment(nestedStackB, "s3deployB", new BucketDeploymentProps {
                 Sources = new [] { Source.JsonData("file.json", new Dictionary<string, string> { { "a", "b" } }) },
                 DestinationBucket = websiteBucketB,
                 LogRetention = RetentionDays.ONE_DAY
             });

Properties

BundlingRequired

Indicates whether the stack requires bundling or not.

public override bool BundlingRequired { get; }
Property Value

bool

Overrides
Stack.BundlingRequired
Remarks

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 does not update the resources of unmodified nested stacks.

Furthermore, this stack will not be treated as an independent deployment artifact (won't be listed in "cdk list" or deployable through "cdk deploy"), but rather only synthesized as a template and uploaded as an asset to S3.

Cross references of resource attributes between the parent stack and the nested stack will automatically be translated to stack parameters and outputs.

ExampleMetadata: infused

NestedStackResource

If this is a nested stack, this represents its AWS::CloudFormation::Stack resource.

public override CfnResource? NestedStackResource { get; }
Property Value

CfnResource

Overrides
Stack.NestedStackResource
Remarks

undefined for top-level (non-nested) stacks.

StackId

An attribute that represents the ID of the stack.

public override string StackId { get; }
Property Value

string

Overrides
Stack.StackId
Remarks

This is a context aware attribute:

    Example value: arn:aws:cloudformation:us-east-2:123456789012:stack/mystack-mynestedstack-sggfrhxhum7w/f449b250-b969-11e0-a185-5081d0136786

    Attribute: true

    StackName

    An attribute that represents the name of the nested stack.

    public override string StackName { get; }
    Property Value

    string

    Overrides
    Stack.StackName
    Remarks

    This is a context aware attribute:

      Example value: mystack-mynestedstack-sggfrhxhum7w

      Attribute: true

      TemplateFile

      The name of the CloudFormation template file emitted to the output directory during synthesis.

      public override string TemplateFile { get; }
      Property Value

      string

      Overrides
      Stack.TemplateFile
      Remarks

      Example value: MyStack.template.json

      Methods

      IsNestedStack(object)

      Checks if x is an object of type NestedStack.

      public static bool IsNestedStack(object x)
      Parameters
      x object
      Returns

      bool

      Remarks

      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 does not update the resources of unmodified nested stacks.

      Furthermore, this stack will not be treated as an independent deployment artifact (won't be listed in "cdk list" or deployable through "cdk deploy"), but rather only synthesized as a template and uploaded as an asset to S3.

      Cross references of resource attributes between the parent stack and the nested stack will automatically be translated to stack parameters and outputs.

      ExampleMetadata: infused

      SetParameter(string, string)

      Assign a value to one of the nested stack parameters.

      public virtual void SetParameter(string name, string value)
      Parameters
      name string

      The parameter name (ID).

      value string

      The value to assign.

      Remarks

      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 does not update the resources of unmodified nested stacks.

      Furthermore, this stack will not be treated as an independent deployment artifact (won't be listed in "cdk list" or deployable through "cdk deploy"), but rather only synthesized as a template and uploaded as an asset to S3.

      Cross references of resource attributes between the parent stack and the nested stack will automatically be translated to stack parameters and outputs.

      ExampleMetadata: infused

      Implements

      ITaggable
      Back to top Generated by DocFX