ReferenceStrength
- class aws_cdk.ReferenceStrength(*values)
Bases:
EnumControls how cross-stack references to a resource are resolved.
- ExampleMetadata:
infused
Example:
# bucket: s3.Bucket # consumer: Stack CfnOutput(consumer, "BucketArn", value=Stack.consume_reference(bucket.bucket_arn, ReferenceStrength.WEAK) )
Attributes
- 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.
- 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.