class CrossStackReferences
| Language | Type name |
|---|---|
.NET | Amazon.CDK.CrossStackReferences |
Go | github.com/aws/aws-cdk-go/awscdk/v2#CrossStackReferences |
Java | software.amazon.awscdk.CrossStackReferences |
Python | aws_cdk.CrossStackReferences |
TypeScript (source) | aws-cdk-lib » CrossStackReferences |
Ergonomic API for configuring cross-stack reference strength on a construct.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
const crossStackReferences = cdk.CrossStackReferences.of(this);
Methods
| Name | Description |
|---|---|
| consume(strength) | Set the default reference strength used when this scope consumes references from other stacks. |
| produce(strength) | Set how this resource is referenced when consumed from another stack. |
| static of(scope) | Returns a CrossStackReferences configurator for the given construct. |
consume(strength)
public consume(strength: ReferenceStrength): void
Parameters
- strength
Reference— - The reference strength to use.Strength
Set the default reference strength used when this scope consumes references from other stacks.
This controls the consuming side: sets the context key that determines how incoming cross-stack references are resolved for this scope and its descendants.
Equivalent to scope.node.setContext(DEFAULT_CROSS_STACK_REFERENCES, strength).
produce(strength)
public produce(strength: ReferenceStrength): void
Parameters
- strength
Reference— - The reference strength to use.Strength
Set how this resource is referenced when consumed from another stack.
This controls the producing side: any cross-stack reference pointing at this resource will use the specified strength instead of the global default.
Equivalent to scope.applyCrossStackReferenceStrength(strength).
static of(scope)
public static of(scope: IConstruct): CrossStackReferences
Parameters
- scope
IConstruct— The construct to configure.
Returns
Returns a CrossStackReferences configurator for the given construct.

.NET
Go
Java
Python
TypeScript (