enum ReferenceStrength
| Language | Type name |
|---|---|
.NET | Amazon.CDK.ReferenceStrength |
Go | github.com/aws/aws-cdk-go/awscdk/v2#ReferenceStrength |
Java | software.amazon.awscdk.ReferenceStrength |
Python | aws_cdk.ReferenceStrength |
TypeScript (source) | aws-cdk-lib » ReferenceStrength |
Controls how cross-stack references to a resource are resolved.
Example
declare const bucket: s3.Bucket;
declare const consumer: Stack;
new CfnOutput(consumer, 'BucketArn', {
value: Stack.consumeReference(bucket.bucketArn, ReferenceStrength.WEAK),
});
Members
| Name | Description |
|---|---|
| STRONG | Strong reference: uses CloudFormation Export/Import (same region) or ExportWriter/ExportReader custom resources (cross-region). |
| WEAK | Weak reference: uses Fn::GetStackOutput to read an output directly from the producing stack. |
| BOTH | Both strong and weak mechanisms are created (transitional state). |
STRONG
Strong reference: uses CloudFormation Export/Import (same region) or ExportWriter/ExportReader custom resources (cross-region).
The producing stack cannot be deleted while consumers exist.
WEAK
Weak reference: uses Fn::GetStackOutput to read an output directly from the producing stack.
The producing stack or resource can be deleted independently of consumers. This will cause infrastructure in consuming stacks to temporarily reference a nonexistant resource until the consumers are updated as well, causing any accesses in that time frame to fail.
Strong references prevent this.
BOTH
Both strong and weak mechanisms are created (transitional state).
Use this when migrating from strong to weak. The producer keeps the strong-side artifacts and also adds a plain Output. The consumer switches to Fn::GetStackOutput.

.NET
Go
Java
Python
TypeScript (