Table of Contents

Interface IEnvironment

Namespace
Amazon.CDK
Assembly
Amazon.CDK.dll

The deployment environment for a stack.

public interface IEnvironment

Examples

// Passing a replication bucket created in a different stack.
            var app = new App();
            var replicationStack = new Stack(app, "ReplicationStack", new StackProps {
                Env = new Environment {
                    Region = "us-west-1"
                }
            });
            var key = new Key(replicationStack, "ReplicationKey");
            var replicationBucket = new Bucket(replicationStack, "ReplicationBucket", new BucketProps {
                // like was said above - replication buckets need a set physical name
                BucketName = PhysicalName.GENERATE_IF_NEEDED,
                EncryptionKey = key
            });

            // later...
            // later...
            new Pipeline(replicationStack, "Pipeline", new PipelineProps {
                CrossRegionReplicationBuckets = new Dictionary<string, IBucket> {
                    { "us-west-1", replicationBucket }
                }
            });

Remarks

ExampleMetadata: infused

Properties

Account

The AWS account ID for this environment.

string? Account { get; }

Property Value

string

Remarks

This can be either a concrete value such as 585191031104 or Aws.accountId 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 concerete region information and will cause this stack to emit synthesis errors.

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

Region

The AWS region for this environment.

string? Region { get; }

Property Value

string

Remarks

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 concerete region information and will cause this stack to emit synthesis errors.

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