Show / Hide Table of Contents

Interface IEnvironment

The deployment environment for a stack.

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

ExampleMetadata: infused

Examples
using Amazon.CDK;
using Amazon.CDK.AWS.CloudWatch;


var app = new App();
var stack = new Stack(app, "Stack", new StackProps { Env = new Environment { Region = "us-west-2" } });

var globalTable = new TableV2(stack, "GlobalTable", new TablePropsV2 {
    PartitionKey = new Attribute { Name = "pk", Type = AttributeType.STRING },
    Replicas = new [] { new ReplicaTableProps { Region = "us-east-1" }, new ReplicaTableProps { Region = "us-east-2" } }
});

// metric is only for the table in us-west-2
var metric = globalTable.MetricConsumedReadCapacityUnits();

new Alarm(this, "Alarm", new AlarmProps {
    Metric = metric,
    EvaluationPeriods = 1,
    Threshold = 1
});

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

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 concrete 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