Interface Environment

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
Environment.Jsii$Proxy

@Generated(value="jsii-pacmak/1.133.0 (build 0f43e37)", date="2026-06-11T16:21:34.118Z") @Stability(Stable) public interface Environment extends software.amazon.jsii.JsiiSerializable
The deployment environment for a stack.

Example:

 Stack stack1 = Stack.Builder.create(app, "Stack1")
         .env(Environment.builder()
                 .region("us-east-1")
                 .build())
         .build();
 Certificate cert = Certificate.Builder.create(stack1, "Cert")
         .domainName("*.example.com")
         .validation(CertificateValidation.fromDns(PublicHostedZone.fromHostedZoneId(stack1, "Zone", "Z0329774B51CGXTDQV3X")))
         .build();
 Stack stack2 = Stack.Builder.create(app, "Stack2")
         .env(Environment.builder()
                 .region("us-east-2")
                 .build())
         .build();
 Distribution.Builder.create(stack2, "Distribution")
         .defaultBehavior(BehaviorOptions.builder()
                 .origin(new HttpOrigin("example.com"))
                 .build())
         .domainNames(List.of("dev.example.com"))
         .certificate(cert)
         .build();
 
  • Method Details

    • getAccount

      @Stability(Stable) @Nullable default String getAccount()
      The AWS account ID for this environment.

      This can be either a concrete value such as 585191031104 or Aws.ACCOUNT_ID which indicates that account ID will only be determined during deployment (it will resolve to the CloudFormation intrinsic {"Ref":"AWS::AccountId"}). Note that certain features, such as cross-stack references and environmental context providers require concrete region information and will cause this stack to emit synthesis errors.

      Default: Aws.ACCOUNT_ID which means that the stack will be account-agnostic.

    • getRegion

      @Stability(Stable) @Nullable default String getRegion()
      The AWS region for this environment.

      This can be either a concrete value such as eu-west-2 or Aws.REGION which indicates that account ID will only be determined during deployment (it will resolve to the CloudFormation intrinsic {"Ref":"AWS::Region"}). Note that certain features, such as cross-stack references and environmental context providers require concrete region information and will cause this stack to emit synthesis errors.

      Default: Aws.REGION which means that the stack will be region-agnostic.

    • builder

      @Stability(Stable) static Environment.Builder builder()
      Returns:
      a Environment.Builder of Environment