Show / Hide Table of Contents

Interface IEnvironment

The deployment environment for a stack.

Namespace: Amazon.CDK
Assembly: Amazon.CDK.dll
Syntax (csharp)
public interface IEnvironment
Syntax (vb)
Public Interface IEnvironment
Remarks

ExampleMetadata: infused

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 }
    }
});

Synopsis

Properties

Account

The AWS account ID for this environment.

Region

The AWS region for this environment.

Properties

Account

The AWS account ID for this environment.

virtual string Account { get; }
Property Value

System.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.

virtual string Region { get; }
Property Value

System.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.

Back to top Generated by DocFX