Enum ReferenceStrength

java.lang.Object
java.lang.Enum<ReferenceStrength>
software.amazon.awscdk.ReferenceStrength
All Implemented Interfaces:
Serializable, Comparable<ReferenceStrength>, java.lang.constant.Constable

@Generated(value="jsii-pacmak/1.133.0 (build 0f43e37)", date="2026-06-04T12:52:05.170Z") @Stability(Stable) public enum ReferenceStrength extends Enum<ReferenceStrength>
Controls how cross-stack references to a resource are resolved.

Example:

 Bucket bucket;
 Stack consumer;
 CfnOutput.Builder.create(consumer, "BucketArn")
         .value(Stack.consumeReference(bucket.getBucketArn(), ReferenceStrength.WEAK))
         .build();
 
  • Enum Constant Details

    • STRONG

      @Stability(Stable) public static final ReferenceStrength 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

      @Stability(Stable) public static final ReferenceStrength 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

      @Stability(Stable) public static final ReferenceStrength 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.

  • Method Details

    • values

      public static ReferenceStrength[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static ReferenceStrength valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null